Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@

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]


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)
Expand All @@ -41,9 +44,23 @@ 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",
Expand All @@ -62,7 +79,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"))
Expand All @@ -81,9 +98,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)

Expand Down Expand Up @@ -114,7 +133,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")

Expand All @@ -135,7 +154,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")

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions testing/constraints-2.7.txt
Original file line number Diff line number Diff line change
@@ -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
Empty file added testing/constraints-3.5.txt
Empty file.
8 changes: 8 additions & 0 deletions testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
@@ -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
Empty file added testing/constraints-3.7.txt
Empty file.
Empty file added testing/constraints-3.8.txt
Empty file.