@@ -416,3 +416,67 @@ def docfx(session):
416
416
os .path .join ("docs" , "" ),
417
417
os .path .join ("docs" , "_build" , "html" , "" ),
418
418
)
419
+
420
+
421
+ @nox .session (python = SYSTEM_TEST_PYTHON_VERSIONS )
422
+ def prerelease_deps (session ):
423
+ """Run all tests with prerelease versions of dependencies installed."""
424
+
425
+ prerel_deps = [
426
+ "protobuf" ,
427
+ "googleapis-common-protos" ,
428
+ "google-auth" ,
429
+ "grpcio" ,
430
+ "grpcio-status" ,
431
+ "google-api-core" ,
432
+ "proto-plus" ,
433
+ # dependencies of google-auth
434
+ "cryptography" ,
435
+ "pyasn1" ,
436
+ ]
437
+
438
+ for dep in prerel_deps :
439
+ session .install ("--pre" , "--no-deps" , "--upgrade" , dep )
440
+
441
+ # Remaining dependencies
442
+ other_deps = ["requests" ]
443
+ session .install (* other_deps )
444
+
445
+ session .install (* UNIT_TEST_STANDARD_DEPENDENCIES )
446
+ session .install (* SYSTEM_TEST_STANDARD_DEPENDENCIES )
447
+
448
+ # Because we test minimum dependency versions on the minimum Python
449
+ # version, the first version we test with in the unit tests sessions has a
450
+ # constraints file containing all dependencies and extras.
451
+ with open (
452
+ CURRENT_DIRECTORY
453
+ / "testing"
454
+ / f"constraints-{ UNIT_TEST_PYTHON_VERSIONS [0 ]} .txt" ,
455
+ encoding = "utf-8" ,
456
+ ) as constraints_file :
457
+ constraints_text = constraints_file .read ()
458
+
459
+ # Ignore leading whitespace and comment lines.
460
+ deps = [
461
+ match .group (1 )
462
+ for match in re .finditer (
463
+ r"^\s*(\S+)(?===\S+)" , constraints_text , flags = re .MULTILINE
464
+ )
465
+ ]
466
+
467
+ # Don't overwrite prerelease packages.
468
+ deps = [dep for dep in deps if dep not in prerel_deps ]
469
+ # We use --no-deps to ensure that pre-release versions aren't overwritten
470
+ # by the version ranges in setup.py.
471
+ session .install (* deps )
472
+ session .install ("--no-deps" , "-e" , ".[all]" )
473
+
474
+ # Print out prerelease package versions
475
+ session .run (
476
+ "python" , "-c" , "import google.protobuf; print(google.protobuf.__version__)"
477
+ )
478
+ session .run ("python" , "-c" , "import grpc; print(grpc.__version__)" )
479
+
480
+ session .run ("py.test" , "tests/unit" )
481
+ session .run ("py.test" , "tests/system" )
482
+ session .run ("py.test" , "samples/snippets" )
0 commit comments