Skip to content

Commit

Permalink
chore: add constraints file (#122)
Browse files Browse the repository at this point in the history
Add constraints file to test lower bounds.
  • Loading branch information
busunkim96 committed Jan 13, 2021
1 parent c2f094b commit c5fee89
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 5 deletions.
16 changes: 12 additions & 4 deletions noxfile.py
Expand Up @@ -14,13 +14,15 @@

from __future__ import absolute_import
import os
import pathlib
import shutil

# https://github.com/google/importlab/issues/25
import nox # pytype: disable=import-error

_MINIMAL_ASYNCIO_SUPPORT_PYTHON_VERSION = [3, 6]
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()

_MINIMAL_ASYNCIO_SUPPORT_PYTHON_VERSION = [3, 6]

def _greater_or_equal_than_36(version_string):
tokens = version_string.split(".")
Expand All @@ -40,9 +42,13 @@ 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"
)

# 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("-e", ".", "-c", constraints_path)

pytest_args = [
"python",
Expand Down Expand Up @@ -80,9 +86,11 @@ def unit(session):
@nox.session(python=["2.7", "3.6", "3.7", "3.8", "3.9"])
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("grpcio-gcp", "-c", constraints_path)

default(session)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -33,7 +33,7 @@
"protobuf >= 3.12.0",
"google-auth >= 1.21.1, < 2.0dev",
"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"',
Expand Down
Empty file added testing/constraints-2.7.txt
Empty file.
Empty file added testing/constraints-3.10.txt
Empty file.
Empty file added testing/constraints-3.11.txt
Empty file.
16 changes: 16 additions & 0 deletions testing/constraints-3.6.txt
@@ -0,0 +1,16 @@
# 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
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
grpcio-gcp==0.2.2
Empty file added testing/constraints-3.7.txt
Empty file.
Empty file added testing/constraints-3.8.txt
Empty file.
Empty file added testing/constraints-3.9.txt
Empty file.

0 comments on commit c5fee89

Please sign in to comment.