Skip to content

Commit 5c63b48

Browse files
authored
build: update default python version to 3.12 (#770)
1 parent b023de2 commit 5c63b48

File tree

3 files changed

+7
-111
lines changed

3 files changed

+7
-111
lines changed

.github/workflows/test_suite.yml

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Python
3030
uses: actions/setup-python@v6
3131
with:
32-
python-version: 3.8
32+
python-version: 3.12
3333
- name: Install nox
3434
run: python -m pip install nox
3535
- name: Run Unit Tests
@@ -69,30 +69,6 @@ jobs:
6969
run: nox -s _all_samples
7070
working-directory: samples
7171

72-
compliance_tests_13:
73-
runs-on: ubuntu-latest
74-
75-
services:
76-
emulator-0:
77-
image: gcr.io/cloud-spanner-emulator/emulator
78-
ports:
79-
- 9010:9010
80-
81-
steps:
82-
- name: Checkout code
83-
uses: actions/checkout@v5
84-
- name: Setup Python
85-
uses: actions/setup-python@v6
86-
with:
87-
python-version: 3.8
88-
- name: Install nox
89-
run: python -m pip install nox
90-
- name: Run Compliance Tests
91-
run: nox -s compliance_test_13
92-
env:
93-
SPANNER_EMULATOR_HOST: localhost:9010
94-
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
95-
9672
compliance_tests_14:
9773
runs-on: ubuntu-latest
9874

@@ -108,7 +84,7 @@ jobs:
10884
- name: Setup Python
10985
uses: actions/setup-python@v6
11086
with:
111-
python-version: 3.8
87+
python-version: 3.12
11288
- name: Install nox
11389
run: python -m pip install nox
11490
- name: Run Compliance Tests
@@ -181,35 +157,11 @@ jobs:
181157
- name: Setup Python
182158
uses: actions/setup-python@v6
183159
with:
184-
python-version: 3.8
160+
python-version: 3.12
185161
- name: Install nox
186162
run: python -m pip install nox
187163
- name: Run Migration Tests
188164
run: nox -s migration_test
189165
env:
190166
SPANNER_EMULATOR_HOST: localhost:9010
191167
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging
192-
193-
migration1310_tests:
194-
runs-on: ubuntu-latest
195-
196-
services:
197-
emulator-0:
198-
image: gcr.io/cloud-spanner-emulator/emulator:latest
199-
ports:
200-
- 9010:9010
201-
202-
steps:
203-
- name: Checkout code
204-
uses: actions/checkout@v5
205-
- name: Setup Python
206-
uses: actions/setup-python@v6
207-
with:
208-
python-version: 3.8
209-
- name: Install nox
210-
run: python -m pip install nox
211-
- name: Run Migration Tests
212-
run: nox -s migration_test_1310
213-
env:
214-
SPANNER_EMULATOR_HOST: localhost:9010
215-
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging

migration_test_cleanup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def main(argv):
3131
instance = client.instance(instance_id="".join(instance_id).replace("/", ""))
3232
database = instance.database("".join(database_id).replace("/", ""))
3333

34-
database.update_ddl(["DROP TABLE account", "DROP TABLE alembic_version"]).result(120)
34+
database.update_ddl(["DROP TABLE IF EXISTS account", "DROP TABLE IF EXISTS alembic_version"]).result(120)
3535

3636

3737
if __name__ == "__main__":

noxfile.py

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class = StreamHandler
7777

7878
BLACK_VERSION = "black==22.3.0"
7979
BLACK_PATHS = ["google", "test", "noxfile.py", "setup.py", "samples"]
80-
DEFAULT_PYTHON_VERSION = "3.8"
80+
DEFAULT_PYTHON_VERSION = "3.12"
8181
DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 = "3.12"
8282

8383

@@ -126,50 +126,6 @@ def lint_setup_py(session):
126126
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
127127

128128

129-
@nox.session(python=DEFAULT_PYTHON_VERSION)
130-
def compliance_test_13(session):
131-
"""Run SQLAlchemy dialect compliance test suite."""
132-
133-
# Check the value of `RUN_COMPLIANCE_TESTS` env var. It defaults to true.
134-
if os.environ.get("RUN_COMPLIANCE_TESTS", "true") == "false":
135-
session.skip("RUN_COMPLIANCE_TESTS is set to false, skipping")
136-
# Sanity check: Only run tests if the environment variable is set.
137-
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", "") and not os.environ.get(
138-
"SPANNER_EMULATOR_HOST", ""
139-
):
140-
session.skip(
141-
"Credentials or emulator host must be set via environment variable"
142-
)
143-
144-
session.install(
145-
"pytest-cov",
146-
)
147-
148-
session.install("mock")
149-
session.install(".[tracing]")
150-
session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.24", "--force-reinstall")
151-
session.run("pip", "install", "opentelemetry-api<=1.10", "--force-reinstall")
152-
session.run("pip", "install", "opentelemetry-sdk<=1.10", "--force-reinstall")
153-
session.run("python", "create_test_database.py")
154-
session.run("pip", "install", "pytest==6.2.2", "--force-reinstall")
155-
session.run(
156-
"pip", "install", "pytest-asyncio<0.21.0", "--force-reinstall", "--no-deps"
157-
)
158-
159-
session.run(
160-
"py.test",
161-
"--cov=google.cloud.sqlalchemy_spanner",
162-
"--cov=test",
163-
"--cov-append",
164-
"--cov-config=.coveragerc",
165-
"--cov-report=",
166-
"--cov-fail-under=0",
167-
"--asyncio-mode=auto",
168-
"test/test_suite_13.py",
169-
*session.posargs,
170-
)
171-
172-
173129
@nox.session(python=DEFAULT_PYTHON_VERSION)
174130
def compliance_test_14(session):
175131
"""Run SQLAlchemy dialect compliance test suite."""
@@ -333,15 +289,8 @@ def mockserver(session):
333289

334290
@nox.session(python=DEFAULT_PYTHON_VERSION)
335291
def migration_test(session):
336-
"""Test migrations with SQLAlchemy v1.3.11+ and Alembic"""
337-
session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall")
338-
_migration_test(session)
339-
340-
341-
@nox.session(python=DEFAULT_PYTHON_VERSION)
342-
def migration_test_1310(session):
343-
"""Test migrations with SQLAlchemy 1.3.10 or lower and Alembic"""
344-
session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.10", "--force-reinstall")
292+
"""Test migrations with SQLAlchemy v1.4 and Alembic"""
293+
session.run("pip", "install", "sqlalchemy>=1.4,<2.0", "--force-reinstall")
345294
_migration_test(session)
346295

347296

@@ -352,11 +301,6 @@ def _migration_test(session):
352301
import os
353302
import shutil
354303

355-
try:
356-
import sqlalchemy
357-
except:
358-
session.run("pip", "install", "sqlalchemy>=1.3.11,<2.0", "--force-reinstall")
359-
360304
session.install("pytest")
361305
session.install(".")
362306
session.install("alembic")

0 commit comments

Comments
 (0)