-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
"unit", | ||
"unit_grpc_gcp", | ||
"unit_wo_grpc", | ||
"unit_with_auth_aio", | ||
"unit_with_async_rest_extra", | ||
"cover", | ||
"pytype", | ||
"mypy", | ||
|
@@ -110,7 +110,7 @@ def install_prerelease_dependencies(session, constraints_path): | |
session.install(*other_deps) | ||
|
||
|
||
def default(session, install_grpc=True, prerelease=False, install_auth_aio=False): | ||
def default(session, install_grpc=True, prerelease=False, install_async_rest=False): | ||
"""Default unit test session. | ||
This is intended to be run **without** an interpreter set, so | ||
|
@@ -130,24 +130,40 @@ def default(session, install_grpc=True, prerelease=False, install_auth_aio=False | |
) | ||
|
||
constraints_dir = str(CURRENT_DIRECTORY / "testing") | ||
|
||
constraints_type = "async-rest-" if install_async_rest else "" | ||
if prerelease: | ||
install_prerelease_dependencies( | ||
session, f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt" | ||
session, | ||
f"{constraints_dir}/constraints-{constraints_type}{PYTHON_VERSIONS[0]}.txt", | ||
) | ||
# This *must* be the last install command to get the package from source. | ||
session.install("-e", ".", "--no-deps") | ||
else: | ||
session.install( | ||
"-e", | ||
".[grpc]" if install_grpc else ".", | ||
"-c", | ||
f"{constraints_dir}/constraints-{session.python}.txt", | ||
"-e", "." + ("[async_rest]" if install_async_rest else ""), "--no-deps" | ||
) | ||
else: | ||
constraints_file = ( | ||
f"{constraints_dir}/constraints-{constraints_type}{session.python}.txt" | ||
) | ||
# fall back to standard constraints file | ||
if not pathlib.Path(constraints_file).exists(): | ||
constraints_file = f"{constraints_dir}/constraints-{session.python}.txt" | ||
|
||
if install_auth_aio: | ||
session.install( | ||
"google-auth @ git+https://[email protected]/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad" | ||
"-e", | ||
"." | ||
+ ( | ||
"[grpc,async_rest]" | ||
if install_grpc and install_async_rest | ||
else ( | ||
"[grpc]" | ||
if install_grpc | ||
else "[async_rest]" | ||
if install_async_rest | ||
else "" | ||
) | ||
), | ||
"-c", | ||
constraints_file, | ||
) | ||
|
||
# Print out package versions of dependencies | ||
|
@@ -236,9 +252,9 @@ def unit_wo_grpc(session): | |
|
||
|
||
@nox.session(python=PYTHON_VERSIONS) | ||
def unit_with_auth_aio(session): | ||
"""Run the unit test suite with google.auth.aio installed""" | ||
default(session, install_auth_aio=True) | ||
def unit_with_async_rest_extra(session): | ||
"""Run the unit test suite with the `async_rest` extra""" | ||
default(session, install_async_rest=True) | ||
|
||
|
||
@nox.session(python=DEFAULT_PYTHON_VERSION) | ||
|
@@ -261,7 +277,7 @@ def mypy(session): | |
"""Run type-checking.""" | ||
# TODO(https://github.com/googleapis/python-api-core/issues/682): | ||
# Use the latest version of mypy instead of mypy<1.11.0 | ||
session.install(".[grpc]", "mypy<1.11.0") | ||
session.install(".[grpc,async_rest]", "mypy<1.11.0") | ||
session.install( | ||
"types-setuptools", | ||
"types-requests", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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.56.2 | ||
protobuf==3.19.5 | ||
google-auth==2.35.0 | ||
# from google-auth[aiohttp] | ||
aiohttp==3.6.2 | ||
requests==2.20.0 | ||
grpcio==1.33.2 | ||
grpcio-status==1.33.2 | ||
grpcio-gcp==0.2.2 | ||
proto-plus==1.22.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters