@@ -454,7 +454,7 @@ def prerelease_deps(session, protobuf_implementation):
454454 " " "
455455 Run all tests with pre-release versions of dependencies installed
456456 rather than the standard non pre-release versions.
457- Pre-releases versions can be installed using
457+ Pre-release versions can be installed using
458458 `pip install --pre <package>`.
459459 " " "
460460
@@ -464,16 +464,16 @@ def prerelease_deps(session, protobuf_implementation):
464464 # Install all dependencies
465465 session.install( " -e" , " ." )
466466
467- unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
468467 # Install dependencies for the unit test environment
468+ unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
469469 session.install(*unit_deps_all)
470470
471+ # Install dependencies for the system test environment
471472 system_deps_all = (
472473 SYSTEM_TEST_STANDARD_DEPENDENCIES
473474 + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
474475 + SYSTEM_TEST_EXTRAS
475476 )
476- # Install dependencies for the system test environment
477477 session.install(*system_deps_all)
478478
479479 # Because we test minimum dependency versions on the minimum Python
@@ -498,37 +498,44 @@ def prerelease_deps(session, protobuf_implementation):
498498 # Install dependencies specified in `testing /constraints-X.txt`.
499499 session.install(*constraints_deps)
500500
501+ # Note: If a dependency is added to the `prerel_deps` list,
502+ # the `core_dependencies_from_source` list in the `core_deps_from_source`
503+ # nox session should also be updated.
501504 prerel_deps = [
502- " protobuf" ,
503- # dependency of grpc
504- " six" ,
505- " grpc-google-iam-v1" ,
506505 " googleapis-common-protos" ,
507- " grpcio" ,
508- " grpcio-status" ,
509506 " google-api-core" ,
510507 " google-auth" ,
508+ " grpc-google-iam-v1" ,
509+ " grpcio" ,
510+ " grpcio-status" ,
511+ " protobuf" ,
511512 " proto-plus" ,
512- " google-cloud-testutils" ,
513- # dependencies of google-cloud-testutils "
514- " click " ,
515513 ]
516514
517515 for dep in prerel_deps:
518- session.install(" --pre " , " --no-deps " , " --upgrade " , dep)
519-
520- # Remaining dependencies
521- other_deps = [
522- " requests " ,
523- ]
524- session.install(*other_deps)
525-
526- # Print out prerelease package versions
527- session.run(
528- " python " , " -c " , " import google.protobuf; print(google.protobuf.__version__) "
529- )
530- session.run(" python " , " -c " , " import grpc; print(grpc.__version__) " )
531- session.run(" python " , " -c " , " import google.auth; print(google.auth.__version__) " )
516+ session.install( " --pre" , " --no-deps" , " --ignore-installed" , dep)
517+ # TODO(https: //github.com /grpc /grpc /issues /38965): Add `grpcio-status``
518+ # to the dictionary below once this bug is fixed.
519+ # TODO(https: //github.com /googleapis /google-cloud-python /issues /13643): Add
520+ # `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below
521+ # once this bug is fixed.
522+ package_namespaces = {
523+ " google-api-core" : " google.api_core" ,
524+ " google-auth" : " google.auth" ,
525+ " grpcio" : " grpc" ,
526+ " protobuf" : " google.protobuf" ,
527+ " proto-plus" : " proto" ,
528+ }
529+
530+ version_namespace = package_namespaces.get(dep)
531+
532+ print(f " Installed {dep}" )
533+ if version_namespace:
534+ session.run(
535+ " python" ,
536+ " -c" ,
537+ f " import {version_namespace}; print({version_namespace}.__version__)" ,
538+ )
532539
533540 session.run(
534541 " py.test" ,
@@ -545,12 +552,12 @@ def prerelease_deps(session, protobuf_implementation):
545552 [ " python" , " upb" ],
546553)
547554def core_deps_from_source(session, protobuf_implementation):
548- " " " Run all tests with local versions of core dependencies installed,
549- rather than pulling core dependencies from PyPI.
555+ " " " Run all tests with core dependencies installed from source
556+ rather than pulling the dependencies from PyPI.
550557 " " "
551558
552559 # Install all dependencies
553- session.install(" . " )
560+ session.install( " -e " , " ." )
554561
555562 # Install dependencies for the unit test environment
556563 unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -566,7 +573,7 @@ def core_deps_from_source(session, protobuf_implementation):
566573
567574 # Because we test minimum dependency versions on the minimum Python
568575 # version, the first version we test with in the unit tests sessions has a
569- # constraints file containing all dependencies and extras that should be installed .
576+ # constraints file containing all dependencies and extras.
570577 with open(
571578 CURRENT_DIRECTORY
572579 / " testing"
@@ -586,17 +593,24 @@ def core_deps_from_source(session, protobuf_implementation):
586593 # Install dependencies specified in `testing /constraints-X.txt`.
587594 session.install(*constraints_deps)
588595
596+ # TODO(https: //github.com /googleapis /gapic-generator-python /issues /2358): `grpcio` and
597+ # `grpcio-status` should be added to the list below so that they are installed from source,
598+ # rather than PyPI.
599+ # TODO(https: //github.com /googleapis /gapic-generator-python /issues /2357): `protobuf` should be
600+ # added to the list below so that it is installed from source, rather than PyPI
601+ # Note: If a dependency is added to the `core_dependencies_from_source` list,
602+ # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
589603 core_dependencies_from_source = [
604+ f " {CURRENT_DIRECTORY}/../googleapis-common-protos" ,
590605 " google-api-core @ git+https://github.com/googleapis/python-api-core.git" ,
591606 " google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
592- f" {CURRENT_DIRECTORY} /.. /googleapis-common-protos " ,
593607 f " {CURRENT_DIRECTORY}/../grpc-google-iam-v1" ,
594608 " proto-plus @ git+https://github.com/googleapis/proto-plus-python.git" ,
595-
596609 ]
597610
598611 for dep in core_dependencies_from_source:
599- session.install(dep, " --ignore-installed " , " --no-deps " )
612+ session.install(dep, " --no-deps" , " --ignore-installed" )
613+ print(f " Installed {dep}" )
600614
601615 session.run(
602616 " py.test" ,
0 commit comments