diff --git a/packages/googleapis-common-protos/noxfile.py b/packages/googleapis-common-protos/noxfile.py index a11c62685f9f..97386de959b3 100644 --- a/packages/googleapis-common-protos/noxfile.py +++ b/packages/googleapis-common-protos/noxfile.py @@ -47,7 +47,7 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--strict") -def default(session): +def default(session, repository=None): # Install all test dependencies, then install this package in-place. session.install("asyncmock", "pytest-asyncio") @@ -55,10 +55,17 @@ def default(session): session.install("mock==5.0.0", "pytest", "pytest-cov") session.install("-e", ".") + # Use the repository specific constraints path if it exists constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}-{repository}.txt" ) + # If there is no repository specific constraints path, use the default one. + if not Path(constraints_path).exists(): + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + # Install googleapis-api-common-protos # This *must* be the last install command to get the package from source. session.install("-e", ".", "-c", constraints_path) @@ -78,12 +85,12 @@ def default(session): ) -def unit(session): +def unit(session, repository=None): """Run the unit test suite.""" - default(session) + default(session, repository) -def system(session): +def system(session, repository=None): """Run the system test suite.""" system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -107,10 +114,18 @@ def system(session): session.install("-e", ".") + # Use the repository specific constraints path if it exists constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}-{repository}.txt" ) + # If there is no repository specific constraints path, use the default one. + if not Path(constraints_path).exists(): + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + + # Install googleapis-api-common-protos # This *must* be the last install command to get the package from source. session.install("-e", ".", "-c", constraints_path) @@ -160,14 +175,14 @@ def test(session, library): if package: session.cd(f'packages/{package}') - unit(session) + unit(session, repository) # system tests are run on 3.7 only if session.python == "3.7": if repository == "python-pubsub": session.install("psutil") session.install("flaky") - system(session) + system(session, repository) @nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]) def tests_local(session): diff --git a/packages/googleapis-common-protos/setup.py b/packages/googleapis-common-protos/setup.py index 9171fb93822b..7c2ba63757bc 100644 --- a/packages/googleapis-common-protos/setup.py +++ b/packages/googleapis-common-protos/setup.py @@ -27,9 +27,7 @@ "protobuf>=3.19.5,<5.0.0.dev0,!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -# Require grpcio >= 1.51.3 for compatibility with Mac M1 -# https://github.com/googleapis/python-pubsub/pull/900 -extras_require = {"grpc": ["grpcio >= 1.51.3, <2.0.0.dev0"]} +extras_require = {"grpc": ["grpcio >= 1.44.0, <2.0.0.dev0"]} package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/packages/googleapis-common-protos/testing/constraints-3.7-python-pubsub.txt b/packages/googleapis-common-protos/testing/constraints-3.7-python-pubsub.txt new file mode 100644 index 000000000000..4a10643eb095 --- /dev/null +++ b/packages/googleapis-common-protos/testing/constraints-3.7-python-pubsub.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List *all* library dependencies and extras in this file. +# Pin the version to the lower bound. +# +# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", +# Then this file should have foo==1.14.0 +protobuf==3.19.5 +grpcio==1.51.3 diff --git a/packages/googleapis-common-protos/testing/constraints-3.7.txt b/packages/googleapis-common-protos/testing/constraints-3.7.txt index 4a10643eb095..6a71809c6af1 100644 --- a/packages/googleapis-common-protos/testing/constraints-3.7.txt +++ b/packages/googleapis-common-protos/testing/constraints-3.7.txt @@ -6,4 +6,4 @@ # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 protobuf==3.19.5 -grpcio==1.51.3 +grpcio==1.44.0 diff --git a/packages/googleapis-common-protos/testing/constraints-3.9-python-pubsub.txt b/packages/googleapis-common-protos/testing/constraints-3.9-python-pubsub.txt new file mode 100644 index 000000000000..87ee8c9d595e --- /dev/null +++ b/packages/googleapis-common-protos/testing/constraints-3.9-python-pubsub.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List *all* library dependencies and extras in this file. +# Pin the version to the lower bound. +# +# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", +# Then this file should have foo==1.14.0 +protobuf==3.20.2 +grpcio==1.51.3 diff --git a/packages/googleapis-common-protos/testing/constraints-3.9.txt b/packages/googleapis-common-protos/testing/constraints-3.9.txt index 87ee8c9d595e..53e10d198b4a 100644 --- a/packages/googleapis-common-protos/testing/constraints-3.9.txt +++ b/packages/googleapis-common-protos/testing/constraints-3.9.txt @@ -6,4 +6,4 @@ # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 protobuf==3.20.2 -grpcio==1.51.3 +grpcio==1.44.0