From c8df1d437531644c61a4f152643ed1e3092a790c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 18 Nov 2025 17:23:09 -0800 Subject: [PATCH 1/2] fix: make the TLS tests skip when pyopenssl isn't available In some distributions e.g. yocto pyOpenSSL is a packageconfig and disabled by default, and it means pyopenssl.py module is not installed as a result. This test fails plainly when it can not find urllib3.contrib.pyopenssl instead skip the test if it does not find the module. --- tests/transport/test__custom_tls_signer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/transport/test__custom_tls_signer.py b/tests/transport/test__custom_tls_signer.py index 3a33c2c02..6f88ddfcf 100644 --- a/tests/transport/test__custom_tls_signer.py +++ b/tests/transport/test__custom_tls_signer.py @@ -18,7 +18,10 @@ import mock import pytest # type: ignore from requests.packages.urllib3.util.ssl_ import create_urllib3_context # type: ignore -import urllib3.contrib.pyopenssl # type: ignore +urllib3_pyopenssl = pytest.importorskip( + "urllib3.contrib.pyopenssl", + reason="urllib3.contrib.pyopenssl not available in this environment", +) from google.auth import exceptions from google.auth.transport import _custom_tls_signer From d0333b63d71ccda5dc460dff0793d0e62904dbc8 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 17 Dec 2025 20:24:27 +0000 Subject: [PATCH 2/2] fix build --- tests/transport/test__custom_tls_signer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/transport/test__custom_tls_signer.py b/tests/transport/test__custom_tls_signer.py index 6f88ddfcf..e993b0338 100644 --- a/tests/transport/test__custom_tls_signer.py +++ b/tests/transport/test__custom_tls_signer.py @@ -18,6 +18,7 @@ import mock import pytest # type: ignore from requests.packages.urllib3.util.ssl_ import create_urllib3_context # type: ignore + urllib3_pyopenssl = pytest.importorskip( "urllib3.contrib.pyopenssl", reason="urllib3.contrib.pyopenssl not available in this environment", @@ -26,7 +27,7 @@ from google.auth import exceptions from google.auth.transport import _custom_tls_signer -urllib3.contrib.pyopenssl.inject_into_urllib3() +urllib3_pyopenssl.inject_into_urllib3() FAKE_ENTERPRISE_CERT_FILE_PATH = "/path/to/enterprise/cert/file" ENTERPRISE_CERT_FILE = os.path.join(