public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-google-auth] epel10: Run the tests
@ 2026-07-29 22:46 Benjamin A. Beasley
0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-07-29 22:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-google-auth
Branch : epel10
Commit : 652ea203b6da37d69fa0565a057623148d358d82
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date : 2025-10-19T12:45:32+01:00
Stats : +109/-3 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/python-google-auth/c/652ea203b6da37d69fa0565a057623148d358d82?branch=epel10
Log:
Run the tests
---
diff --git a/python-google-auth.spec b/python-google-auth.spec
index 60d8cb1..d451035 100644
--- a/python-google-auth.spec
+++ b/python-google-auth.spec
@@ -6,6 +6,9 @@
# break this dependency.
%bcond grpcio 1
+%bcond tests 1
+%bcond pytest_localserver %[ %{undefined el10} && %{undefined el9} ]
+
Name: python-google-auth
Version: 2.41.1
Release: 2%{?dist}
@@ -21,11 +24,17 @@ BuildArch: noarch
BuildRequires: python3-devel
%if %{with grpcio}
-# For google.auth.transport.grpc; see also
+# For import-checking google.auth.transport.grpc; see also
# https://github.com/googleapis/google-auth-library-python/issues/1735.
BuildRequires: %{py3_dist grpcio}
%endif
+%if %{with tests}
+# Some tests in tests/transport/test_requests.py and
+# tests/transport/test_urllib3.py require this.
+BuildRequires: %{py3_dist certifi}
+%endif
+
%global common_description %{expand:
This library simplifies using Google’s various server-to-server authentication
mechanisms to access Google APIs.}
@@ -55,6 +64,43 @@ Summary: %{summary}
%prep
%autosetup -n google-auth-library-python-%{version}
+# use unittest.mock instead of mock
+# https://github.com/googleapis/google-auth-library-python/issues/1055
+#
+# Needed for https://fedoraproject.org/wiki/Changes/DeprecatePythonMock.
+#
+# See also https://github.com/googleapis/google-auth-library-python/pull/1786,
+# https://github.com/googleapis/google-auth-library-python/pull/1361, but these
+# are out of date and upstream has failed to act for months, so we use a more
+# “dynamic” sed-patch to avoid constant rebasing
+find tests* system_tests -type f -name '*.py' -exec \
+ sed -r -i -e 's/^(from )(mock)\b/\1unittest\.\2/' \
+ -e 's/^(import mock)/from unittest \1/' '{}' '+'
+sed -r -i 's/^([[:blank:]]*)("mock",)$/\1# \2/' setup.py
+
+# Upstream expands dependencies for extras into the testing extra. Omit any
+# missing extras from the testing extra.
+%if %{without pyjwt}
+sed -r -i 's/^([[:blank:]]*)(\*pyjwt_extra_require,)$/\1# \2/' setup.py
+%endif
+%if %{without reauth}
+sed -r -i 's/^([[:blank:]]*)(\*reauth_extra_require,)$/\1# \2/' setup.py
+%endif
+
+%if %{without pytest_localserver}
+sed -r -i 's/^([[:blank:]]*)("pytest-localserver\b[^"]*",)$/\1# \2/' setup.py
+%endif
+
+# We cannot respect version upper bounds that were added for testing:
+# "pyopenssl < 24.3.0",
+# "aiohttp < 3.10.0",
+sed -r -i 's/^([[:blank:]]*"(pyopenssl|aiohttp))\b[^"]+(",)$/\1\3/' setup.py
+
+%if %{defined el9}
+# We must loosen the lower bound on the cryptography version.
+sed -r -i 's/^([[:blank:]]*"cryptography) >= [^"]+(",)$/\1\2/' setup.py
+%endif
+
%generate_buildrequires
%{pyproject_buildrequires \
@@ -68,7 +114,7 @@ Summary: %{summary}
-x reauth \
%endif
-x requests \
-%if 0
+%if %{with tests}
-x testing \
%endif
-x urllib3}
@@ -89,7 +135,66 @@ Summary: %{summary}
%else
%pyproject_check_import -e google.auth.transport.grpc
%endif
-# TODO: Try to run some tests.
+
+%if %{with tests}
+# Requires python-google-cloud-storage, which we don’t really want to add as a
+# build dependency.
+ignore="${ignore-} --ignore=samples/cloud-client/snippets/snippets_test.py"
+
+# Require additional test data files not in the repository:
+ignore="${ignore-} --ignore=system_tests"
+
+%if %{without pyjwt}
+k="${k-}${k+ and }not test_verify_token_jwk"
+%endif
+
+%if %{without reauth}
+ignore="${ignore-} --ignore=tests/oauth2/test_challenges.py"
+%endif
+
+%if %{without pytest_localserver}
+ignore="${ignore-} --ignore=tests/transport/compliance.py"
+ignore="${ignore-} --ignore=tests/transport/test__http_client.py"
+ignore="${ignore-} --ignore=tests/transport/test_requests.py"
+ignore="${ignore-} --ignore=tests/transport/test_urllib3.py"
+ignore="${ignore-} --ignore=tests_async/transport/async_compliance.py"
+ignore="${ignore-} --ignore=tests_async/transport/test_aiohttp_requests.py"
+%endif
+
+# TODO: What would it take to fix these?
+# > loop = loop or asyncio.get_running_loop()
+# E RuntimeError: no running event loop
+k="${k-}${k+ and }not (TestRequestResponse and test_unsupported_session)"
+k="${k-}${k+ and }not (TestAuthorizedSession and test_constructor)"
+k="${k-}${k+ and }not (TestAuthorizedSession and test_constructor_with_auth_request)"
+
+# TestDecryptPrivateKey::test_success fails with pyOpenSSL 24.3.0+ #1665
+# https://github.com/googleapis/google-auth-library-python/issues/1665
+k="${k-}${k+ and }not (TestDecryptPrivateKey and test_success)"
+
+%if %{defined el9}
+# TODO: We have not tried to investigate these EPEL9-specific failures.
+
+# ERROR at teardown of TestAsyncAuthorizedSession.test_request_provided_auth_request_success _
+# […]
+# E ValueError: Async generator fixture didn't stop.Yield only once.
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_request_provided_auth_request_success)"
+
+# E TypeError: object bool can't be used in 'await' expression
+k="${k-}${k+ and }not (TestTimeoutGuard and test_timeout_with_simple_async_task_within_bounds)"
+# E TypeError: object Mock can't be used in 'await' expression
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_http_delete_method_success)"
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_http_get_method_success)"
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_http_patch_method_success)"
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_http_post_method_success)"
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_http_put_method_success)"
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_request_default_auth_request_success)"
+# E TypeError: 'async for' requires an object with __aiter__ method, got bytes
+k="${k-}${k+ and }not (TestAsyncAuthorizedSession and test_request_provided_auth_request_success)"
+%endif
+
+%pytest ${ignore-} -k "${k-}" -v
+%endif
%files -n python3-google-auth -f %{pyproject_files}
@@ -99,6 +204,7 @@ Summary: %{summary}
* Sun Oct 19 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 1:2.41.1-2
- Migrate to pyproject-rpm-macros (fix RHBZ#2377753)
- Add missing extras metapackages
+- Run the tests
* Wed Oct 01 2025 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 1:2.41.1-1
- Update to 2.41.1 (#2400572)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-29 22:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-29 22:46 [rpms/python-google-auth] epel10: Run the tests Benjamin A. Beasley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox