@@ -385,7 +385,7 @@ def prerelease_deps(session, protobuf_implementation):
385385 """
386386 Run all tests with pre-release versions of dependencies installed
387387 rather than the standard non pre-release versions.
388- Pre-releases versions can be installed using
388+ Pre-release versions can be installed using
389389 `pip install --pre <package>`.
390390 """
391391
@@ -395,16 +395,16 @@ def prerelease_deps(session, protobuf_implementation):
395395 # Install all dependencies
396396 session .install ("-e" , "." )
397397
398- unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
399398 # Install dependencies for the unit test environment
399+ unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
400400 session .install (* unit_deps_all )
401401
402+ # Install dependencies for the system test environment
402403 system_deps_all = (
403404 SYSTEM_TEST_STANDARD_DEPENDENCIES
404405 + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
405406 + SYSTEM_TEST_EXTRAS
406407 )
407- # Install dependencies for the system test environment
408408 session .install (* system_deps_all )
409409
410410 # Because we test minimum dependency versions on the minimum Python
@@ -429,37 +429,44 @@ def prerelease_deps(session, protobuf_implementation):
429429 # Install dependencies specified in `testing/constraints-X.txt`.
430430 session .install (* constraints_deps )
431431
432+ # Note: If a dependency is added to the `prerel_deps` list,
433+ # the `core_dependencies_from_source` list in the `core_deps_from_source`
434+ # nox session should also be updated.
432435 prerel_deps = [
433- "protobuf" ,
434- # dependency of grpc
435- "six" ,
436- "grpc-google-iam-v1" ,
437436 "googleapis-common-protos" ,
438- "grpcio" ,
439- "grpcio-status" ,
440437 "google-api-core" ,
441438 "google-auth" ,
439+ "grpc-google-iam-v1" ,
440+ "grpcio" ,
441+ "grpcio-status" ,
442+ "protobuf" ,
442443 "proto-plus" ,
443- "google-cloud-testutils" ,
444- # dependencies of google-cloud-testutils"
445- "click" ,
446444 ]
447445
448446 for dep in prerel_deps :
449- session .install ("--pre" , "--no-deps" , "--upgrade" , dep )
450-
451- # Remaining dependencies
452- other_deps = [
453- "requests" ,
454- ]
455- session .install (* other_deps )
456-
457- # Print out prerelease package versions
458- session .run (
459- "python" , "-c" , "import google.protobuf; print(google.protobuf.__version__)"
460- )
461- session .run ("python" , "-c" , "import grpc; print(grpc.__version__)" )
462- session .run ("python" , "-c" , "import google.auth; print(google.auth.__version__)" )
447+ session .install ("--pre" , "--no-deps" , "--ignore-installed" , dep )
448+ # TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status``
449+ # to the dictionary below once this bug is fixed.
450+ # TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add
451+ # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below
452+ # once this bug is fixed.
453+ package_namespaces = {
454+ "google-api-core" : "google.api_core" ,
455+ "google-auth" : "google.auth" ,
456+ "grpcio" : "grpc" ,
457+ "protobuf" : "google.protobuf" ,
458+ "proto-plus" : "proto" ,
459+ }
460+
461+ version_namespace = package_namespaces .get (dep )
462+
463+ print (f"Installed { dep } " )
464+ if version_namespace :
465+ session .run (
466+ "python" ,
467+ "-c" ,
468+ f"import { version_namespace } ; print({ version_namespace } .__version__)" ,
469+ )
463470
464471 session .run (
465472 "py.test" ,
@@ -476,12 +483,12 @@ def prerelease_deps(session, protobuf_implementation):
476483 ["python" , "upb" ],
477484)
478485def core_deps_from_source (session , protobuf_implementation ):
479- """Run all tests with local versions of core dependencies installed,
480- rather than pulling core dependencies from PyPI.
486+ """Run all tests with core dependencies installed from source
487+ rather than pulling the dependencies from PyPI.
481488 """
482489
483490 # Install all dependencies
484- session .install ("." )
491+ session .install ("-e" , " ." )
485492
486493 # Install dependencies for the unit test environment
487494 unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -497,7 +504,7 @@ def core_deps_from_source(session, protobuf_implementation):
497504
498505 # Because we test minimum dependency versions on the minimum Python
499506 # version, the first version we test with in the unit tests sessions has a
500- # constraints file containing all dependencies and extras that should be installed .
507+ # constraints file containing all dependencies and extras.
501508 with open (
502509 CURRENT_DIRECTORY
503510 / "testing"
@@ -517,16 +524,24 @@ def core_deps_from_source(session, protobuf_implementation):
517524 # Install dependencies specified in `testing/constraints-X.txt`.
518525 session .install (* constraints_deps )
519526
527+ # TODO(https://github.com/googleapis/gapic-generator-python/issues/2358): `grpcio` and
528+ # `grpcio-status` should be added to the list below so that they are installed from source,
529+ # rather than PyPI.
530+ # TODO(https://github.com/googleapis/gapic-generator-python/issues/2357): `protobuf` should be
531+ # added to the list below so that it is installed from source, rather than PyPI
532+ # Note: If a dependency is added to the `core_dependencies_from_source` list,
533+ # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
520534 core_dependencies_from_source = [
535+ f"{ CURRENT_DIRECTORY } /../googleapis-common-protos" ,
521536 "google-api-core @ git+https://github.com/googleapis/python-api-core.git" ,
522537 "google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
523- f"{ CURRENT_DIRECTORY } /../googleapis-common-protos" ,
524538 f"{ CURRENT_DIRECTORY } /../grpc-google-iam-v1" ,
525539 "proto-plus @ git+https://github.com/googleapis/proto-plus-python.git" ,
526540 ]
527541
528542 for dep in core_dependencies_from_source :
529- session .install (dep , "--ignore-installed" , "--no-deps" )
543+ session .install (dep , "--no-deps" , "--ignore-installed" )
544+ print (f"Installed { dep } " )
530545
531546 session .run (
532547 "py.test" ,
0 commit comments