Skip to content

Commit a8f806e

Browse files
ohmayrgcf-owl-bot[bot]parthea
authored
chore: add testing requirements extra (#1707)
* chore: add testing requirements extra * address PR feedback * update extra for build * add missing test deps * add pyjwt extra * add reauth extra * refactor extras in setup file * address unit test failures * link issues * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update setup.py Co-authored-by: Anthonios Partheniou <[email protected]> * Update setup.py Co-authored-by: Anthonios Partheniou <[email protected]> * address PR feedback * Update setup.py Co-authored-by: Anthonios Partheniou <[email protected]> * Update setup.py Co-authored-by: Anthonios Partheniou <[email protected]> * Update setup.py Co-authored-by: Anthonios Partheniou <[email protected]> * address PR comments --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 59e0b38 commit a8f806e

File tree

3 files changed

+66
-34
lines changed

3 files changed

+66
-34
lines changed

noxfile.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def unit(session):
8989
constraints_path = str(
9090
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
9191
)
92-
session.install("-r", "testing/requirements.txt", "-c", constraints_path)
93-
session.install("-e", ".", "-c", constraints_path)
92+
session.install("-e", ".[testing]", "-c", constraints_path)
9493
session.run(
9594
"pytest",
9695
f"--junitxml=unit_{session.python}_sponge_log.xml",
@@ -105,8 +104,7 @@ def unit(session):
105104

106105
@nox.session(python="3.8")
107106
def cover(session):
108-
session.install("-r", "testing/requirements.txt")
109-
session.install("-e", ".")
107+
session.install("-e", ".[testing]")
110108
session.run(
111109
"pytest",
112110
"--cov=google.auth",
@@ -144,8 +142,7 @@ def docs(session):
144142

145143
@nox.session(python="pypy")
146144
def pypy(session):
147-
session.install("-r", "testing/requirements.txt")
148-
session.install("-e", ".")
145+
session.install("-e", ".[testing]")
149146
session.run(
150147
"pytest",
151148
f"--junitxml=unit_{session.python}_sponge_log.xml",

setup.py

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,70 @@
2727
"rsa>=3.1.4,<5",
2828
)
2929

30+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1737): Unit test fails with
31+
# `No module named 'cryptography.hazmat.backends.openssl.x509' for Python 3.7``.
32+
cryptography_base_require = [
33+
"cryptography >= 38.0.3",
34+
"cryptography < 39.0.0; python_version < '3.8'",
35+
]
36+
37+
requests_extra_require = ["requests >= 2.20.0, < 3.0.0"]
38+
39+
aiohttp_extra_require = ["aiohttp >= 3.6.2, < 4.0.0", *requests_extra_require]
40+
41+
pyjwt_extra_require = ["pyjwt>=2.0", *cryptography_base_require]
42+
43+
reauth_extra_require = ["pyu2f>=0.1.5"]
44+
45+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1738): Add bounds for cryptography and pyopenssl dependencies.
46+
enterprise_cert_extra_require = ["cryptography", "pyopenssl"]
47+
48+
pyopenssl_extra_require = ["pyopenssl>=20.0.0", cryptography_base_require]
49+
50+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1739): Add bounds for urllib3 and packaging dependencies.
51+
urllib3_extra_require = ["urllib3", "packaging"]
52+
53+
# Unit test requirements.
54+
testing_extra_require = [
55+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1735): Remove `grpcio` from testing requirements once an extra is added for `grpcio` dependency.
56+
"grpcio",
57+
"flask",
58+
"freezegun",
59+
"mock",
60+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1736): Remove `oauth2client` from testing requirements once an extra is added for `oauth2client` dependency.
61+
"oauth2client",
62+
*pyjwt_extra_require,
63+
"pytest",
64+
"pytest-cov",
65+
"pytest-localserver",
66+
*pyopenssl_extra_require,
67+
*reauth_extra_require,
68+
"responses",
69+
*urllib3_extra_require,
70+
# Async Dependencies
71+
*aiohttp_extra_require,
72+
"aioresponses",
73+
"pytest-asyncio",
74+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1665): Remove the pinned version of pyopenssl
75+
# once `TestDecryptPrivateKey::test_success` is updated to remove the deprecated `OpenSSL.crypto.sign` and
76+
# `OpenSSL.crypto.verify` methods. See: https://www.pyopenssl.org/en/latest/changelog.html#id3.
77+
"pyopenssl < 24.3.0",
78+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1722): `test_aiohttp_requests` depend on
79+
# aiohttp < 3.10.0 which is a bug. Investigate and remove the pinned aiohttp version.
80+
"aiohttp < 3.10.0",
81+
]
82+
3083
extras = {
31-
"aiohttp": ["aiohttp >= 3.6.2, < 4.0.0.dev0", "requests >= 2.20.0, < 3.0.0.dev0"],
32-
"pyopenssl": ["pyopenssl>=20.0.0", "cryptography>=38.0.3"],
33-
"requests": "requests >= 2.20.0, < 3.0.0.dev0",
34-
"reauth": "pyu2f>=0.1.5",
35-
"enterprise_cert": ["cryptography", "pyopenssl"],
36-
"pyjwt": ["pyjwt>=2.0", "cryptography>=38.0.3"],
37-
"urllib3": ["urllib3", "packaging"],
84+
"aiohttp": aiohttp_extra_require,
85+
"enterprise_cert": enterprise_cert_extra_require,
86+
"pyopenssl": pyopenssl_extra_require,
87+
"pyjwt": pyjwt_extra_require,
88+
"reauth": reauth_extra_require,
89+
"requests": requests_extra_require,
90+
"testing": testing_extra_require,
91+
"urllib3": urllib3_extra_require,
92+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1735): Add an extra for `grpcio` dependency.
93+
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1736): Add an extra for `oauth2client` dependency.
3894
}
3995

4096
with io.open("README.rst", "r") as fh:

testing/requirements.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)