4040
4141SYSTEM_TEST_PYTHON_VERSIONS = ALL_PYTHON
4242
43+ DJANGO_VERSIONS = ["5.2" , "6.0" ]
44+
4345UNIT_TEST_STANDARD_DEPENDENCIES = [
4446 "mock" ,
4547 "pytest" ,
6163]
6264
6365UNIT_TEST_MOCKSERVER_DEPENDENCIES = [
64- "django>=5.2,<6.1" ,
65- "google-cloud-spanner>=3.69.1" ,
66+ "google-cloud-spanner>=3.70.0" ,
6667 "sqlparse>=0.4.4" ,
6768]
6869
@@ -124,12 +125,22 @@ def lint_setup_py(session):
124125 session .run ("python" , "setup.py" , "check" , "--restructuredtext" , "--strict" )
125126
126127
127- def default (session ):
128+ def default (session , django_version = "5.2" ):
129+ # Django 6.0 dropped support for Python 3.10 and 3.11 (requires Python >= 3.12)
130+ if django_version == "6.0" and session .python in ("3.10" , "3.11" ):
131+ session .skip (f"Django { django_version } requires Python >= 3.12" )
132+
133+ # Target specific Django version
134+ django_dep = (
135+ f"django~={ django_version } .0" if django_version == "6.0" else "django~=5.2.0"
136+ )
137+
128138 # Install all test dependencies, then install this package in-place.
129139 session .install (
130140 * UNIT_TEST_STANDARD_DEPENDENCIES ,
131141 * UNIT_TEST_EXTERNAL_DEPENDENCIES ,
132142 * UNIT_TEST_MOCKSERVER_DEPENDENCIES ,
143+ django_dep ,
133144 )
134145 session .install ("-e" , "." )
135146
@@ -149,32 +160,17 @@ def default(session):
149160
150161
151162@nox .session (python = ALL_PYTHON )
152- def unit (session ):
153- """Run the unit test suite."""
154- default (session )
163+ @nox .parametrize ("django" , DJANGO_VERSIONS )
164+ def unit (session , django ):
165+ """Run the unit test suite across Django versions."""
166+ default (session , django_version = django )
155167
156168
157169@nox .session (python = MOCKSERVER_TEST_PYTHON_VERSION )
158- def mockserver (session ):
159- # Install all test dependencies, then install this package in-place.
160- session .install (
161- * UNIT_TEST_STANDARD_DEPENDENCIES ,
162- * UNIT_TEST_EXTERNAL_DEPENDENCIES ,
163- * UNIT_TEST_MOCKSERVER_DEPENDENCIES ,
164- )
165- session .install ("-e" , "." )
166- session .run (
167- "py.test" ,
168- "--quiet" ,
169- "--cov=django_spanner" ,
170- "--cov=tests.mockserver_tests" ,
171- "--cov-append" ,
172- "--cov-config=.coveragerc" ,
173- "--cov-report=" ,
174- "--cov-fail-under=0" ,
175- os .path .join ("tests" , "mockserver_tests" ),
176- * session .posargs ,
177- )
170+ @nox .parametrize ("django" , DJANGO_VERSIONS )
171+ def mockserver (session , django ):
172+ """Run mockserver tests across Django versions."""
173+ default (session , django_version = django )
178174
179175
180176def system_test (session ):
0 commit comments