Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit d2b62db

Browse files
chore(python): remove noxfile.py from templates
Source-Link: googleapis/synthtool@7765802 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:25de45b58e52021d3a24a6273964371a97a4efeefe6ad3845a64e697c63b6447
1 parent 724983a commit d2b62db

2 files changed

Lines changed: 161 additions & 2 deletions

File tree

.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:5581906b957284864632cde4e9c51d1cc66b0094990b27e689132fe5cd036046
17-
# created: 2024-03-05
16+
digest: sha256:25de45b58e52021d3a24a6273964371a97a4efeefe6ad3845a64e697c63b6447
17+
# created: 2025-04-14T14:34:43.260858345Z

noxfile.py

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import pathlib
2323
import re
2424
import re
25+
import re
2526
import shutil
2627
from typing import Dict, List
2728
import warnings
@@ -32,6 +33,7 @@
3233
BLACK_VERSION = "black[jupyter]==23.7.0"
3334
ISORT_VERSION = "isort==5.11.0"
3435
LINT_PATHS = [
36+
"third_party",
3537
"third_party",
3638
"docs",
3739
"sqlalchemy_bigquery",
@@ -120,6 +122,7 @@
120122

121123
# Error if a python version is missing
122124
nox.options.stop_on_first_error = True
125+
nox.options.stop_on_first_error = True
123126
nox.options.error_on_missing_interpreters = True
124127

125128

@@ -228,6 +231,14 @@ def unit(session, protobuf_implementation, install_extras=True):
228231
install_target = "."
229232
session.install("-e", install_target, "-c", constraints_path)
230233

234+
if install_extras and session.python in ["3.11", "3.12"]:
235+
install_target = ".[geography,alembic,tests,bqstorage]"
236+
elif install_extras:
237+
install_target = ".[all]"
238+
else:
239+
install_target = "."
240+
session.install("-e", install_target, "-c", constraints_path)
241+
231242
# TODO(https://github.com/googleapis/synthtool/issues/1976):
232243
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
233244
# The 'cpp' implementation requires Protobuf<4.
@@ -371,6 +382,150 @@ def system_noextras(session):
371382
)
372383

373384

385+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
386+
def system_noextras(session):
387+
"""Run the system test suite."""
388+
constraints_path = str(
389+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
390+
)
391+
system_test_path = os.path.join("tests", "system.py")
392+
system_test_folder_path = os.path.join("tests", "system")
393+
394+
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
395+
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
396+
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
397+
# Install pyopenssl for mTLS testing.
398+
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
399+
session.install("pyopenssl")
400+
401+
system_test_exists = os.path.exists(system_test_path)
402+
system_test_folder_exists = os.path.exists(system_test_folder_path)
403+
# Sanity check: only run tests if found.
404+
if not system_test_exists and not system_test_folder_exists:
405+
session.skip("System tests were not found")
406+
407+
global SYSTEM_TEST_EXTRAS_BY_PYTHON
408+
SYSTEM_TEST_EXTRAS_BY_PYTHON = False
409+
install_systemtest_dependencies(session, "-c", constraints_path)
410+
411+
# Run py.test against the system tests.
412+
if system_test_exists:
413+
session.run(
414+
"py.test",
415+
"--quiet",
416+
f"--junitxml=system_{session.python}_sponge_log.xml",
417+
system_test_path,
418+
*session.posargs,
419+
)
420+
if system_test_folder_exists:
421+
session.run(
422+
"py.test",
423+
"--quiet",
424+
f"--junitxml=system_{session.python}_sponge_log.xml",
425+
system_test_folder_path,
426+
*session.posargs,
427+
)
428+
429+
430+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1])
431+
def compliance(session):
432+
"""Run the SQLAlchemy dialect-compliance system tests"""
433+
constraints_path = str(
434+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
435+
)
436+
system_test_folder_path = os.path.join("tests", "sqlalchemy_dialect_compliance")
437+
438+
if os.environ.get("RUN_COMPLIANCE_TESTS", "true") == "false":
439+
session.skip("RUN_COMPLIANCE_TESTS is set to false, skipping")
440+
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
441+
session.install("pyopenssl")
442+
if not os.path.exists(system_test_folder_path):
443+
session.skip("Compliance tests were not found")
444+
445+
session.install(
446+
"mock",
447+
"pytest",
448+
"pytest-rerunfailures",
449+
"google-cloud-testutils",
450+
"-c",
451+
constraints_path,
452+
)
453+
if session.python == "3.8":
454+
extras = "[tests,alembic]"
455+
elif session.python in ["3.11", "3.12"]:
456+
extras = "[tests,geography]"
457+
else:
458+
extras = "[tests]"
459+
session.install("-e", f".{extras}", "-c", constraints_path)
460+
461+
session.run("python", "-m", "pip", "freeze")
462+
463+
session.run(
464+
"py.test",
465+
"-vv",
466+
f"--junitxml=compliance_{session.python}_sponge_log.xml",
467+
"--reruns=3",
468+
"--reruns-delay=60",
469+
"--only-rerun=Exceeded rate limits",
470+
"--only-rerun=Already Exists",
471+
"--only-rerun=Not found",
472+
"--only-rerun=Cannot execute DML over a non-existent table",
473+
"--only-rerun=Job exceeded rate limits",
474+
system_test_folder_path,
475+
*session.posargs,
476+
# To suppress the "Deprecated API features detected!" warning when
477+
# features not compatible with 2.0 are detected, use a value of "1"
478+
env={
479+
"SQLALCHEMY_SILENCE_UBER_WARNING": "1",
480+
},
481+
)
482+
483+
484+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
485+
def system_noextras(session):
486+
"""Run the system test suite."""
487+
constraints_path = str(
488+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
489+
)
490+
system_test_path = os.path.join("tests", "system.py")
491+
system_test_folder_path = os.path.join("tests", "system")
492+
493+
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
494+
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
495+
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
496+
# Install pyopenssl for mTLS testing.
497+
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
498+
session.install("pyopenssl")
499+
500+
system_test_exists = os.path.exists(system_test_path)
501+
system_test_folder_exists = os.path.exists(system_test_folder_path)
502+
# Sanity check: only run tests if found.
503+
if not system_test_exists and not system_test_folder_exists:
504+
session.skip("System tests were not found")
505+
506+
global SYSTEM_TEST_EXTRAS_BY_PYTHON
507+
SYSTEM_TEST_EXTRAS_BY_PYTHON = False
508+
install_systemtest_dependencies(session, "-c", constraints_path)
509+
510+
# Run py.test against the system tests.
511+
if system_test_exists:
512+
session.run(
513+
"py.test",
514+
"--quiet",
515+
f"--junitxml=system_{session.python}_sponge_log.xml",
516+
system_test_path,
517+
*session.posargs,
518+
)
519+
if system_test_folder_exists:
520+
session.run(
521+
"py.test",
522+
"--quiet",
523+
f"--junitxml=system_{session.python}_sponge_log.xml",
524+
system_test_folder_path,
525+
*session.posargs,
526+
)
527+
528+
374529
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1])
375530
def compliance(session):
376531
"""Run the SQLAlchemy dialect-compliance system tests"""
@@ -457,6 +612,8 @@ def docs(session):
457612
"alabaster",
458613
"geoalchemy2",
459614
"shapely",
615+
"geoalchemy2",
616+
"shapely",
460617
"recommonmark",
461618
)
462619

@@ -494,6 +651,8 @@ def docfx(session):
494651
"alabaster",
495652
"geoalchemy2",
496653
"shapely",
654+
"geoalchemy2",
655+
"shapely",
497656
"recommonmark",
498657
)
499658

0 commit comments

Comments
 (0)