@@ -385,7 +385,7 @@ def prerelease_deps(session, protobuf_implementation):
385
385
"""
386
386
Run all tests with pre-release versions of dependencies installed
387
387
rather than the standard non pre-release versions.
388
- Pre-releases versions can be installed using
388
+ Pre-release versions can be installed using
389
389
`pip install --pre <package>`.
390
390
"""
391
391
@@ -395,16 +395,16 @@ def prerelease_deps(session, protobuf_implementation):
395
395
# Install all dependencies
396
396
session .install ("-e" , "." )
397
397
398
- unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
399
398
# Install dependencies for the unit test environment
399
+ unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
400
400
session .install (* unit_deps_all )
401
401
402
+ # Install dependencies for the system test environment
402
403
system_deps_all = (
403
404
SYSTEM_TEST_STANDARD_DEPENDENCIES
404
405
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
405
406
+ SYSTEM_TEST_EXTRAS
406
407
)
407
- # Install dependencies for the system test environment
408
408
session .install (* system_deps_all )
409
409
410
410
# Because we test minimum dependency versions on the minimum Python
@@ -429,37 +429,44 @@ def prerelease_deps(session, protobuf_implementation):
429
429
# Install dependencies specified in `testing/constraints-X.txt`.
430
430
session .install (* constraints_deps )
431
431
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.
432
435
prerel_deps = [
433
- "protobuf" ,
434
- # dependency of grpc
435
- "six" ,
436
- "grpc-google-iam-v1" ,
437
436
"googleapis-common-protos" ,
438
- "grpcio" ,
439
- "grpcio-status" ,
440
437
"google-api-core" ,
441
438
"google-auth" ,
439
+ "grpc-google-iam-v1" ,
440
+ "grpcio" ,
441
+ "grpcio-status" ,
442
+ "protobuf" ,
442
443
"proto-plus" ,
443
- "google-cloud-testutils" ,
444
- # dependencies of google-cloud-testutils"
445
- "click" ,
446
444
]
447
445
448
446
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
+ )
463
470
464
471
session .run (
465
472
"py.test" ,
@@ -476,12 +483,12 @@ def prerelease_deps(session, protobuf_implementation):
476
483
["python" , "upb" ],
477
484
)
478
485
def 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.
481
488
"""
482
489
483
490
# Install all dependencies
484
- session .install ("." )
491
+ session .install ("-e" , " ." )
485
492
486
493
# Install dependencies for the unit test environment
487
494
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -497,7 +504,7 @@ def core_deps_from_source(session, protobuf_implementation):
497
504
498
505
# Because we test minimum dependency versions on the minimum Python
499
506
# 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.
501
508
with open (
502
509
CURRENT_DIRECTORY
503
510
/ "testing"
@@ -517,16 +524,24 @@ def core_deps_from_source(session, protobuf_implementation):
517
524
# Install dependencies specified in `testing/constraints-X.txt`.
518
525
session .install (* constraints_deps )
519
526
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.
520
534
core_dependencies_from_source = [
535
+ f"{ CURRENT_DIRECTORY } /../googleapis-common-protos" ,
521
536
"google-api-core @ git+https://github.com/googleapis/python-api-core.git" ,
522
537
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git" ,
523
- f"{ CURRENT_DIRECTORY } /../googleapis-common-protos" ,
524
538
f"{ CURRENT_DIRECTORY } /../grpc-google-iam-v1" ,
525
539
"proto-plus @ git+https://github.com/googleapis/proto-plus-python.git" ,
526
540
]
527
541
528
542
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 } " )
530
545
531
546
session .run (
532
547
"py.test" ,
0 commit comments