@@ -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,47 @@ 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+ try:
531+ version_namespace = package_namespaces[dep]
532+ except KeyError:
533+ version_namespace = None
534+
535+ print(f " Installed {dep}" )
536+ if version_namespace:
537+ session.run(
538+ " python" ,
539+ " -c" ,
540+ f " import {version_namespace}; print({version_namespace}.__version__)" ,
541+ )
532542
533543 session.run(
534544 " py.test" ,
@@ -545,12 +555,12 @@ def prerelease_deps(session, protobuf_implementation):
545555 [ " python" , " upb" ],
546556)
547557def 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.
558+ " " " Run all tests with core dependencies installed from source
559+ rather than pulling the dependencies from PyPI.
550560 " " "
551561
552562 # Install all dependencies
553- session.install(" . " )
563+ session.install( " -e " , " ." )
554564
555565 # Install dependencies for the unit test environment
556566 unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -566,7 +576,7 @@ def core_deps_from_source(session, protobuf_implementation):
566576
567577 # Because we test minimum dependency versions on the minimum Python
568578 # 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 .
579+ # constraints file containing all dependencies and extras.
570580 with open(
571581 CURRENT_DIRECTORY
572582 / " testing"
@@ -586,17 +596,23 @@ def core_deps_from_source(session, protobuf_implementation):
586596 # Install dependencies specified in `testing /constraints-X.txt`.
587597 session.install(*constraints_deps)
588598
599+ # TODO(hhttps: //github.com /googleapis /gapic-generator-python /issues /2358): `grpcio` and
600+ # `grpcio-status` should be added to the list below so that it is installed from source, rather than PyPI
601+ # TODO(https: //github.com /googleapis /gapic-generator-python /issues /2357): `protobuf` should be
602+ # added to the list below so that it is installed from source, rather than PyPI
603+ # Note: If a dependency is added to the `core_dependencies_from_source` list,
604+ # the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
589605 core_dependencies_from_source = [
606+ " proto-plus @ git+https://github.com/googleapis/proto-plus-python.git" ,
607+ f " {CURRENT_DIRECTORY}/../googleapis-common-protos" ,
590608 " google-api-core @ git+https://github.com/googleapis/python-api-core.git" ,
591609 " google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
592- f" {CURRENT_DIRECTORY} /.. /googleapis-common-protos " ,
593610 f " {CURRENT_DIRECTORY}/../grpc-google-iam-v1" ,
594- " proto-plus @ git+https: //github.com /googleapis /proto-plus-python.git " ,
595-
596611 ]
597612
598613 for dep in core_dependencies_from_source:
599- session.install(dep, " --ignore-installed " , " --no-deps " )
614+ session.install(dep, " --no-deps" , " --ignore-installed" )
615+ print(f " Installed {dep}" )
600616
601617 session.run(
602618 " py.test" ,
0 commit comments