@@ -306,9 +306,12 @@ def unit(session, test_type):
306306 if session .python in ("3.7" ,):
307307 session .skip ("Python 3.7 is no longer supported" )
308308
309- if test_type == "mockserver" and session .python != DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 :
309+ if (
310+ test_type == "mockserver"
311+ and session .python != DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20
312+ ):
310313 session .skip ("mockserver tests only run on python 3.14" )
311-
314+
312315 if test_type == "mockserver" :
313316 mockserver (session )
314317 return
@@ -323,13 +326,21 @@ def unit(session, test_type):
323326 session .install ("opentelemetry-sdk" )
324327 session .install ("opentelemetry-instrumentation" )
325328 session .run (
326- "python" , "create_test_config.py" , "my-project" , "my-instance" , "my-database"
329+ "python" ,
330+ "create_test_config.py" ,
331+ "my-project" ,
332+ "my-instance" ,
333+ "my-database" ,
327334 )
328335 session .run ("py.test" , "--quiet" , os .path .join ("test/unit" ), * session .posargs )
329336 return
330337
338+
331339@nox .session (python = SYSTEM_COMPLIANCE_MIGRATION_TEST_PYTHON_VERSIONS )
332- @nox .parametrize ("test_type" , ["system" , "compliance_14" , "compliance_20" , "migration_14" , "migration_20" ])
340+ @nox .parametrize (
341+ "test_type" ,
342+ ["system" , "compliance_14" , "compliance_20" , "migration_14" , "migration_20" ],
343+ )
333344def system (session , test_type ):
334345 """Run SQLAlchemy dialect system test suite."""
335346
@@ -347,10 +358,20 @@ def system(session, test_type):
347358
348359 if test_type == "system" and session .python not in SYSTEM_TEST_PYTHON_VERSIONS :
349360 session .skip ("Standard system tests configured to run exclusively on 3.12" )
350- if test_type in ["compliance_14" , "migration_14" ] and session .python != UNIT_TEST_PYTHON_VERSIONS [0 ]:
351- session .skip (f"SQLAlchemy 1.4-based tests configured to run exclusively on { UNIT_TEST_PYTHON_VERSIONS [0 ]} " )
352- if test_type in ["compliance_20" , "migration_20" ] and session .python != DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 :
353- session .skip (f"SQLAlchemy 2.0-based tests configured to run exclusively on { DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 } " )
361+ if (
362+ test_type in ["compliance_14" , "migration_14" ]
363+ and session .python != UNIT_TEST_PYTHON_VERSIONS [0 ]
364+ ):
365+ session .skip (
366+ f"SQLAlchemy 1.4-based tests configured to run exclusively on { UNIT_TEST_PYTHON_VERSIONS [0 ]} "
367+ )
368+ if (
369+ test_type in ["compliance_20" , "migration_20" ]
370+ and session .python != DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20
371+ ):
372+ session .skip (
373+ f"SQLAlchemy 2.0-based tests configured to run exclusively on { DEFAULT_PYTHON_VERSION_FOR_SQLALCHEMY_20 } "
374+ )
354375
355376 if test_type == "system" :
356377 session .install ("pytest" , "pytest-cov" , "pytest-asyncio" )
@@ -361,7 +382,9 @@ def system(session, test_type):
361382 session .install ("opentelemetry-instrumentation" )
362383 session .run ("python" , "create_test_database.py" )
363384 session .install ("sqlalchemy>=2.0" )
364- session .run ("py.test" , "--quiet" , os .path .join ("test" , "system" ), * session .posargs )
385+ session .run (
386+ "py.test" , "--quiet" , os .path .join ("test" , "system" ), * session .posargs
387+ )
365388 session .run ("python" , "drop_test_database.py" )
366389 elif test_type == "compliance_14" :
367390 compliance_test_14 (session )
@@ -372,25 +395,30 @@ def system(session, test_type):
372395 elif test_type == "migration_20" :
373396 _migration_test (session )
374397
398+
375399@nox .session (python = DEFAULT_PYTHON_VERSION )
376400def mypy (session ):
377401 """Run the type checker."""
378402 session .skip ("mypy tests are not yet supported" )
379403
404+
380405@nox .session (python = DEFAULT_PYTHON_VERSION )
381406def core_deps_from_source (session ):
382407 """Run all tests with core dependencies installed from source"""
383408 session .skip ("Core deps from source tests are not yet supported" )
384409
410+
385411@nox .session (python = DEFAULT_PYTHON_VERSION )
386412def prerelease_deps (session ):
387413 """Run all tests with prerelease versions of dependencies installed."""
388414 session .skip ("prerelease deps tests are not yet supported" )
389415
416+
390417@nox .session
391418def format (session : nox .sessions .Session ) -> None :
392419 session .install (BLACK_VERSION , ISORT_VERSION )
393420 import os
421+
394422 python_files = [path for path in os .listdir ("." ) if path .endswith (".py" )]
395423 session .run ("isort" , "--fss" , * python_files )
396424 session .run ("black" , * python_files )
0 commit comments