Skip to content

Commit a3207b7

Browse files
committed
update noxfile
1 parent 0e1d126 commit a3207b7

1 file changed

Lines changed: 40 additions & 21 deletions

File tree

packages/google-cloud-pubsub/noxfile.py

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
7070

7171
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]
72-
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
72+
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
7373
"mock",
7474
"pytest",
7575
"google-cloud-testutils",
@@ -517,8 +517,15 @@ def docfx(session):
517517
["python", "upb", "cpp"],
518518
)
519519
def prerelease_deps(session, protobuf_implementation):
520-
"""Run all tests with prerelease versions of dependencies installed."""
520+
"""
521+
Run all tests with pre-release versions of dependencies installed
522+
rather than the standard non pre-release versions.
523+
Pre-release versions can be installed using
524+
`pip install --pre <package>`.
525+
"""
521526

527+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
528+
# Remove this check once support for Protobuf 3.x is dropped.
522529
if protobuf_implementation == "cpp" and session.python in (
523530
"3.11",
524531
"3.12",
@@ -528,11 +535,17 @@ def prerelease_deps(session, protobuf_implementation):
528535
session.skip("cpp implementation is not supported in python 3.11+")
529536

530537
# Install all dependencies
531-
session.install("-e", ".[all, tests, tracing]")
538+
session.install("-e", ".")
539+
540+
# Install dependencies for the unit test environment
532541
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
533542
session.install(*unit_deps_all)
543+
544+
# Install dependencies for the system test environment
534545
system_deps_all = (
535-
SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
546+
SYSTEM_TEST_STANDARD_DEPENDENCIES
547+
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
548+
+ SYSTEM_TEST_EXTRAS
536549
)
537550
session.install(*system_deps_all)
538551

@@ -568,26 +581,32 @@ def prerelease_deps(session, protobuf_implementation):
568581
"grpcio-status",
569582
"protobuf",
570583
"proto-plus",
571-
"google-cloud-testutils",
572-
# dependencies of google-cloud-testutils"
573-
"click",
574584
]
575585

576586
for dep in prerel_deps:
577-
session.install("--pre", "--no-deps", "--upgrade", dep)
578-
579-
# Remaining dependencies
580-
other_deps = [
581-
"requests",
582-
]
583-
session.install(*other_deps)
584-
585-
# Print out prerelease package versions
586-
session.run(
587-
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
588-
)
589-
session.run("python", "-c", "import grpc; print(grpc.__version__)")
590-
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
587+
session.install("--pre", "--no-deps", "--ignore-installed", dep)
588+
# TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status``
589+
# to the dictionary below once this bug is fixed.
590+
# TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add
591+
# `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below
592+
# once this bug is fixed.
593+
package_namespaces = {
594+
"google-api-core": "google.api_core",
595+
"google-auth": "google.auth",
596+
"grpcio": "grpc",
597+
"protobuf": "google.protobuf",
598+
"proto-plus": "proto",
599+
}
600+
601+
version_namespace = package_namespaces.get(dep)
602+
603+
print(f"Installed {dep}")
604+
if version_namespace:
605+
session.run(
606+
"python",
607+
"-c",
608+
f"import {version_namespace}; print({version_namespace}.__version__)",
609+
)
591610

592611
session.run(
593612
"py.test",

0 commit comments

Comments
 (0)