diff --git a/packages/google-auth/noxfile.py b/packages/google-auth/noxfile.py index ca829fa96030..76c1d6839522 100644 --- a/packages/google-auth/noxfile.py +++ b/packages/google-auth/noxfile.py @@ -115,14 +115,14 @@ def mypy(session): @nox.session(python=ALL_PYTHON) -@nox.parametrize(["install_deprecated_extras"], (True, False)) -def unit(session, install_deprecated_extras): +@nox.parametrize(["install_extras"], (True, False)) +def unit(session, install_extras): # Install all test dependencies, then install this package in-place. if session.python in ("3.7",): session.skip("Python 3.7 is no longer supported") min_py, max_py = UNIT_TEST_PYTHON_VERSIONS[0], UNIT_TEST_PYTHON_VERSIONS[-1] - if not install_deprecated_extras and session.python not in (min_py, max_py): + if not install_extras and session.python not in (min_py, max_py): # only run double tests on first and last supported versions session.skip( f"Extended tests only run on boundary Python versions ({min_py}, {max_py}) to reduce CI load." @@ -131,12 +131,10 @@ def unit(session, install_deprecated_extras): constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - extras_str = "testing" - if install_deprecated_extras: - # rsa and oauth2client were both archived and support dropped, - # but we still test old code paths - session.install("oauth2client") - extras_str += ",rsa" + if install_extras: + extras_str = "testing" + else: + extras_str = "testing_minimal" session.install("-e", f".[{extras_str}]", "-c", constraints_path) session.run( "pytest", diff --git a/packages/google-auth/setup.py b/packages/google-auth/setup.py index 8a66b7c39d0e..d8d1a30fe3b3 100644 --- a/packages/google-auth/setup.py +++ b/packages/google-auth/setup.py @@ -22,14 +22,16 @@ "cryptography >= 38.0.3", ] +requests_base_require = ["requests >= 2.20.0, < 3.0.0"] + DEPENDENCIES = ( "pyasn1-modules>=0.2.1", cryptography_base_require, + requests_base_require, ) -requests_extra_require = ["requests >= 2.20.0, < 3.0.0"] -aiohttp_extra_require = ["aiohttp >= 3.6.2, < 4.0.0", *requests_extra_require] +aiohttp_extra_require = ["aiohttp >= 3.6.2, < 4.0.0"] pyjwt_extra_require = ["pyjwt>=2.0"] @@ -46,32 +48,36 @@ rsa_extra_require = ["rsa>=3.1.4,<5"] # Unit test requirements. -testing_extra_require = [ +testing_minimal_require = [ # TODO(https://github.com/googleapis/google-auth-library-python/issues/1735): Remove `grpcio` from testing requirements once an extra is added for `grpcio` dependency. "grpcio", "flask", "freezegun", - *pyjwt_extra_require, "pytest", "pytest-cov", "pytest-localserver", + "responses", + "pytest-asyncio", +] + +testing_extra_require = [ + *testing_minimal_require, + *pyjwt_extra_require, *pyopenssl_extra_require, *reauth_extra_require, - "responses", *urllib3_extra_require, # Async Dependencies *aiohttp_extra_require, - "aioresponses", - "pytest-asyncio", - # TODO(https://github.com/googleapis/google-auth-library-python/issues/1665): Remove the pinned version of pyopenssl - # once `TestDecryptPrivateKey::test_success` is updated to remove the deprecated `OpenSSL.crypto.sign` and - # `OpenSSL.crypto.verify` methods. See: https://www.pyopenssl.org/en/latest/changelog.html#id3. - "pyopenssl < 24.3.0", # TODO(https://github.com/googleapis/google-auth-library-python/issues/1722): `test_aiohttp_requests` depend on # aiohttp < 3.10.0 which is a bug. Investigate and remove the pinned aiohttp version. "aiohttp < 3.10.0", + *pyopenssl_extra_require, + "aioresponses", + "oauth2client", + *rsa_extra_require, ] + extras = { # Note: cryptography was made into a required dependency. Extra is kept for backwards compatibility "cryptography": cryptography_base_require, @@ -80,8 +86,9 @@ "pyopenssl": pyopenssl_extra_require, "pyjwt": pyjwt_extra_require, "reauth": reauth_extra_require, - "requests": requests_extra_require, + "requests": requests_base_require, "testing": testing_extra_require, + "testing_minimal": testing_minimal_require, "urllib3": urllib3_extra_require, "rsa": rsa_extra_require, # TODO(https://github.com/googleapis/google-auth-library-python/issues/1735): Add an extra for `grpcio` dependency.