From 8fd4e45c349ec4a75322d387758362c6dae15117 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Fri, 2 Oct 2020 23:28:03 +0000 Subject: [PATCH 1/2] test: test lower bounds --- noxfile.py | 24 +++++++++++++++++------- setup.py | 8 ++++---- testing/constraints-2.7.txt | 9 +++++++++ testing/constraints-3.5.txt | 0 testing/constraints-3.6.txt | 8 ++++++++ testing/constraints-3.7.txt | 0 testing/constraints-3.8.txt | 0 7 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 testing/constraints-2.7.txt create mode 100644 testing/constraints-3.5.txt create mode 100644 testing/constraints-3.6.txt create mode 100644 testing/constraints-3.7.txt create mode 100644 testing/constraints-3.8.txt diff --git a/noxfile.py b/noxfile.py index 989bb9be..98cdcc74 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,12 +14,15 @@ from __future__ import absolute_import import os +import pathlib import shutil import sys # https://github.com/google/importlab/issues/25 import nox # pytype: disable=import-error +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + _MINIMAL_ASYNCIO_SUPPORT_PYTHON_VERSION = [3, 6] @@ -41,9 +44,14 @@ def default(session): Python corresponding to the ``nox`` binary the ``PATH`` can run the tests. """ + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + session.install("pip==20.2") # for 2020 resolver + # Install all test dependencies, then install this package in-place. - session.install("mock", "pytest", "pytest-cov", "grpcio >= 1.0.2") - session.install("-e", ".") + session.install("--use-feature=2020-resolver", "mock", "pytest", "pytest-cov", "-c", constraints_path) + session.install("--use-feature=2020-resolver", "-e", ".[grpc]", "-c", constraints_path) pytest_args = [ "python", @@ -62,7 +70,7 @@ def default(session): # Inject AsyncIO content, if version >= 3.6. if _greater_or_equal_than_36(session.python): - session.install("asyncmock", "pytest-asyncio") + session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) pytest_args.append("--cov=tests.asyncio") pytest_args.append(os.path.join("tests", "asyncio")) @@ -81,9 +89,11 @@ def unit(session): @nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) def unit_grpc_gcp(session): """Run the unit test suite with grpcio-gcp installed.""" - + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) # Install grpcio-gcp - session.install("grpcio-gcp") + session.install("--use-feature=2020-resolver", "grpcio-gcp", "-c", constraints_path) default(session) @@ -114,7 +124,7 @@ def lint_setup_py(session): def pytype(session): """Run type-checking.""" session.install( - ".", "grpcio >= 1.8.2", "grpcio-gcp >= 0.2.2", "pytype >= 2019.3.21" + ".[grpc,grpcio-gcp]", "pytype >= 2019.3.21", ) session.run("pytype") @@ -135,7 +145,7 @@ def cover(session): def docs(session): """Build the docs for this library.""" - session.install(".", "grpcio >= 1.8.2", "grpcio-gcp >= 0.2.2") + session.install(".[grpc,grpcio-gcp]",) session.install("-e", ".") session.install("sphinx < 3.0", "alabaster", "recommonmark") diff --git a/setup.py b/setup.py index e1189664..f863fc9d 100644 --- a/setup.py +++ b/setup.py @@ -29,14 +29,14 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ + 'futures >= 3.2.0; python_version < "3.2"', + "google-auth >= 1.21.1, < 2.0dev", "googleapis-common-protos >= 1.6.0, < 2.0dev", "protobuf >= 3.12.0", - "google-auth >= 1.21.1, < 2.0dev", + "pytz", "requests >= 2.18.0, < 3.0.0dev", - "setuptools >= 34.0.0", + "setuptools >= 40.3.0", "six >= 1.13.0", - "pytz", - 'futures >= 3.2.0; python_version < "3.2"', ] extras = { "grpc": "grpcio >= 1.29.0, < 2.0dev", diff --git a/testing/constraints-2.7.txt b/testing/constraints-2.7.txt new file mode 100644 index 00000000..7d265add --- /dev/null +++ b/testing/constraints-2.7.txt @@ -0,0 +1,9 @@ +googleapis-common-protos==1.6.0 +protobuf==3.12.0 +google-auth==1.21.1 +requests==2.18.0 +setuptools==40.3.0 +six==1.13.0 +futures==3.2.0 +grpcio==1.29.0 +grpcio-gcp==0.2.2 diff --git a/testing/constraints-3.5.txt b/testing/constraints-3.5.txt new file mode 100644 index 00000000..e69de29b diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt new file mode 100644 index 00000000..33e9dc2d --- /dev/null +++ b/testing/constraints-3.6.txt @@ -0,0 +1,8 @@ +googleapis-common-protos==1.6.0 +protobuf==3.12.0 +google-auth==1.21.1 +requests==2.18.0 +setuptools==40.3.0 +six==1.13.0 +grpcio==1.29.0 +grpcio-gcp==0.2.2 \ No newline at end of file diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt new file mode 100644 index 00000000..e69de29b diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt new file mode 100644 index 00000000..e69de29b From e642e6f4e3d77b74ce762f7a5250693cabd63188 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Fri, 2 Oct 2020 23:28:57 +0000 Subject: [PATCH 2/2] chore: blacken noxfile --- noxfile.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 98cdcc74..9f93cce1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,7 +27,7 @@ def _greater_or_equal_than_36(version_string): - tokens = version_string.split('.') + tokens = version_string.split(".") for i, token in enumerate(tokens): try: tokens[i] = int(token) @@ -50,8 +50,17 @@ def default(session): session.install("pip==20.2") # for 2020 resolver # Install all test dependencies, then install this package in-place. - session.install("--use-feature=2020-resolver", "mock", "pytest", "pytest-cov", "-c", constraints_path) - session.install("--use-feature=2020-resolver", "-e", ".[grpc]", "-c", constraints_path) + session.install( + "--use-feature=2020-resolver", + "mock", + "pytest", + "pytest-cov", + "-c", + constraints_path, + ) + session.install( + "--use-feature=2020-resolver", "-e", ".[grpc]", "-c", constraints_path + ) pytest_args = [ "python",