Skip to content

Commit c875cdf

Browse files
committed
updates to noxfile sessions, versions and creds check.
1 parent e35f33b commit c875cdf

1 file changed

Lines changed: 59 additions & 25 deletions

File tree

packages/sqlalchemy-bigquery/noxfile.py

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343

4444
DEFAULT_PYTHON_VERSION = "3.14"
4545

46-
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
46+
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
47+
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
48+
ALL_PYTHON.extend(["3.7"])
4749
UNIT_TEST_STANDARD_DEPENDENCIES = [
4850
"mock",
4951
"asyncmock",
@@ -80,7 +82,7 @@
8082
],
8183
}
8284

83-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.9", "3.12", "3.13", "3.14"]
85+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ALL_PYTHON
8486
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
8587
"mock",
8688
"pytest",
@@ -137,12 +139,14 @@ def wrapper(*args, **kwargs):
137139
"unit",
138140
"system",
139141
"cover",
142+
"prerelease_deps",
143+
"blacken",
140144
"lint",
141145
"lint_setup_py",
142-
"blacken",
146+
"format",
147+
"mypy",
143148
"docs",
144149
"docfx",
145-
"format",
146150
]
147151

148152
# Error if a python version is missing
@@ -235,7 +239,7 @@ def install_unittest_dependencies(session, *constraints):
235239
session.install("-e", ".", *constraints)
236240

237241

238-
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
242+
@nox.session(python=ALL_PYTHON)
239243
@nox.parametrize(
240244
"protobuf_implementation",
241245
["python", "upb", "cpp"],
@@ -332,6 +336,9 @@ def system(session):
332336
system_test_path = os.path.join("tests", "system.py")
333337
system_test_folder_path = os.path.join("tests", "system")
334338

339+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
340+
session.skip("Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS")
341+
335342
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
336343
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
337344
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
@@ -376,6 +383,9 @@ def system_noextras(session):
376383
system_test_path = os.path.join("tests", "system.py")
377384
system_test_folder_path = os.path.join("tests", "system")
378385

386+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
387+
session.skip("Credentials must be set via environment variable GOOGLE_APPLICATION_CREDENTIALS")
388+
379389
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
380390
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
381391
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
@@ -659,24 +669,48 @@ def prerelease_deps(session, protobuf_implementation):
659669

660670
# Only run system tests if found.
661671
if os.path.exists(system_test_path):
662-
session.run(
663-
"py.test",
664-
"--verbose",
665-
f"--junitxml=system_{session.python}_sponge_log.xml",
666-
system_test_path,
667-
*session.posargs,
668-
env={
669-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
670-
},
671-
)
672+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
673+
session.log("Skipping system tests - no credentials")
674+
else:
675+
session.run(
676+
"py.test",
677+
"--verbose",
678+
f"--junitxml=system_{session.python}_sponge_log.xml",
679+
system_test_path,
680+
*session.posargs,
681+
env={
682+
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
683+
},
684+
)
672685
if os.path.exists(system_test_folder_path):
673-
session.run(
674-
"py.test",
675-
"--verbose",
676-
f"--junitxml=system_{session.python}_sponge_log.xml",
677-
system_test_folder_path,
678-
*session.posargs,
679-
env={
680-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
681-
},
682-
)
686+
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
687+
session.log("Skipping system folder tests - no credentials")
688+
else:
689+
session.run(
690+
"py.test",
691+
"--verbose",
692+
f"--junitxml=system_{session.python}_sponge_log.xml",
693+
system_test_folder_path,
694+
*session.posargs,
695+
env={
696+
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
697+
},
698+
)
699+
700+
701+
@nox.session(python=DEFAULT_PYTHON_VERSION)
702+
def mypy(session):
703+
"""Run the type checker."""
704+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
705+
# Add mypy tests
706+
session.skip("mypy tests are not yet supported")
707+
708+
709+
@nox.session(python=DEFAULT_PYTHON_VERSION)
710+
def core_deps_from_source(session):
711+
"""Run all tests with core dependencies installed from source
712+
rather than pulling the dependencies from PyPI.
713+
"""
714+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
715+
# Add core deps from source tests
716+
session.skip("Core deps from source tests are not yet supported")

0 commit comments

Comments
 (0)