From a945114afd98496813f1b7d747f170e9db285c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Wed, 8 Oct 2025 13:33:51 +0200 Subject: [PATCH] build: update default python version to 3.12 --- .github/workflows/test_suite.yml | 54 ++-------------------------- migration_test_cleanup.py | 2 +- noxfile.py | 62 ++------------------------------ 3 files changed, 7 insertions(+), 111 deletions(-) diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml index 82ddea2c..a21f8661 100644 --- a/.github/workflows/test_suite.yml +++ b/.github/workflows/test_suite.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v6 with: - python-version: 3.8 + python-version: 3.12 - name: Install nox run: python -m pip install nox - name: Run Unit Tests @@ -69,30 +69,6 @@ jobs: run: nox -s _all_samples working-directory: samples - compliance_tests_13: - runs-on: ubuntu-latest - - services: - emulator-0: - image: gcr.io/cloud-spanner-emulator/emulator - ports: - - 9010:9010 - - steps: - - name: Checkout code - uses: actions/checkout@v5 - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: 3.8 - - name: Install nox - run: python -m pip install nox - - name: Run Compliance Tests - run: nox -s compliance_test_13 - env: - SPANNER_EMULATOR_HOST: localhost:9010 - GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging - compliance_tests_14: runs-on: ubuntu-latest @@ -108,7 +84,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v6 with: - python-version: 3.8 + python-version: 3.12 - name: Install nox run: python -m pip install nox - name: Run Compliance Tests @@ -181,7 +157,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v6 with: - python-version: 3.8 + python-version: 3.12 - name: Install nox run: python -m pip install nox - name: Run Migration Tests @@ -189,27 +165,3 @@ jobs: env: SPANNER_EMULATOR_HOST: localhost:9010 GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging - - migration1310_tests: - runs-on: ubuntu-latest - - services: - emulator-0: - image: gcr.io/cloud-spanner-emulator/emulator:latest - ports: - - 9010:9010 - - steps: - - name: Checkout code - uses: actions/checkout@v5 - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: 3.8 - - name: Install nox - run: python -m pip install nox - - name: Run Migration Tests - run: nox -s migration_test_1310 - env: - SPANNER_EMULATOR_HOST: localhost:9010 - GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging diff --git a/migration_test_cleanup.py b/migration_test_cleanup.py index c56b10d0..89b1064d 100644 --- a/migration_test_cleanup.py +++ b/migration_test_cleanup.py @@ -31,7 +31,7 @@ def main(argv): instance = client.instance(instance_id="".join(instance_id).replace("/", "")) database = instance.database("".join(database_id).replace("/", "")) - database.update_ddl(["DROP TABLE account", "DROP TABLE alembic_version"]).result(120) + database.update_ddl(["DROP TABLE IF EXISTS account", "DROP TABLE IF EXISTS alembic_version"]).result(120) if __name__ == "__main__": diff --git a/noxfile.py b/noxfile.py index 974daf99..c9f1cb24 100644 --- a/noxfile.py +++ b/noxfile.py @@ -77,7 +77,7 @@ class = StreamHandler BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["google", "test", "noxfile.py", "setup.py", "samples"] -DEFAULT_PYTHON_VERSION = "3.8" +DEFAULT_PYTHON_VERSION = "3.12" DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 = "3.12" @@ -126,50 +126,6 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") -@nox.session(python=DEFAULT_PYTHON_VERSION) -def compliance_test_13(session): - """Run SQLAlchemy dialect compliance test suite.""" - - # Check the value of `RUN_COMPLIANCE_TESTS` env var. It defaults to true. - if os.environ.get("RUN_COMPLIANCE_TESTS", "true") == "false": - session.skip("RUN_COMPLIANCE_TESTS is set to false, skipping") - # Sanity check: Only run tests if the environment variable is set. - if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", "") and not os.environ.get( - "SPANNER_EMULATOR_HOST", "" - ): - session.skip( - "Credentials or emulator host must be set via environment variable" - ) - - session.install( - "pytest-cov", - ) - - session.install("mock") - session.install(".[tracing]") - session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.24", "--force-reinstall") - session.run("pip", "install", "opentelemetry-api<=1.10", "--force-reinstall") - session.run("pip", "install", "opentelemetry-sdk<=1.10", "--force-reinstall") - session.run("python", "create_test_database.py") - session.run("pip", "install", "pytest==6.2.2", "--force-reinstall") - session.run( - "pip", "install", "pytest-asyncio<0.21.0", "--force-reinstall", "--no-deps" - ) - - session.run( - "py.test", - "--cov=google.cloud.sqlalchemy_spanner", - "--cov=test", - "--cov-append", - "--cov-config=.coveragerc", - "--cov-report=", - "--cov-fail-under=0", - "--asyncio-mode=auto", - "test/test_suite_13.py", - *session.posargs, - ) - - @nox.session(python=DEFAULT_PYTHON_VERSION) def compliance_test_14(session): """Run SQLAlchemy dialect compliance test suite.""" @@ -333,15 +289,8 @@ def mockserver(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def migration_test(session): - """Test migrations with SQLAlchemy v1.3.11+ and Alembic""" - session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall") - _migration_test(session) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def migration_test_1310(session): - """Test migrations with SQLAlchemy 1.3.10 or lower and Alembic""" - session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.10", "--force-reinstall") + """Test migrations with SQLAlchemy v1.4 and Alembic""" + session.run("pip", "install", "sqlalchemy>=1.4,<2.0", "--force-reinstall") _migration_test(session) @@ -352,11 +301,6 @@ def _migration_test(session): import os import shutil - try: - import sqlalchemy - except: - session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall") - session.install("pytest") session.install(".") session.install("alembic")