From 45e3606cd45055a422ffffa65e945c86ef9d881a887ec4fea499f4bb1d196b11 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 5 Aug 2025 06:00:05 +0000 Subject: [PATCH] - Do not ignore deprecation warnings, the testsuite explicitly clears all warnings multiple times. - Add patch filter-pyopenssl-deprecationwarning.patch: * Explicitly filter out new DeprecationWarnings raised by PyOpenSSL 25.1+ OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3_1?expand=0&rev=30 --- filter-pyopenssl-deprecationwarning.patch | 133 ++++++++++++++++++++++ python-urllib3_1.changes | 8 ++ python-urllib3_1.spec | 6 +- 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 filter-pyopenssl-deprecationwarning.patch diff --git a/filter-pyopenssl-deprecationwarning.patch b/filter-pyopenssl-deprecationwarning.patch new file mode 100644 index 0000000..1eadd88 --- /dev/null +++ b/filter-pyopenssl-deprecationwarning.patch @@ -0,0 +1,133 @@ +Index: urllib3-1.26.20/test/with_dummyserver/test_https.py +=================================================================== +--- urllib3-1.26.20.orig/test/with_dummyserver/test_https.py ++++ urllib3-1.26.20/test/with_dummyserver/test_https.py +@@ -215,6 +215,10 @@ class TestHTTPS(HTTPSDummyServerTestCase + assert conn.__class__ == VerifiedHTTPSConnection + + with warnings.catch_warnings(record=True) as w: ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", category=DeprecationWarning ++ ) + r = https_pool.request("GET", "/") + assert r.status == 200 + +@@ -245,6 +249,13 @@ class TestHTTPS(HTTPSDummyServerTestCase + r = https_pool.request("GET", "/") + assert r.status == 200 + ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ calls = warn.call_args_list ++ calls = [ ++ call for call in calls if call[0][1] != DeprecationWarning and ++ not call[0][0].startswith("Attempting to mutate a Context") ++ ] ++ + # Modern versions of Python, or systems using PyOpenSSL, don't + # emit warnings. + if ( +@@ -252,7 +263,7 @@ class TestHTTPS(HTTPSDummyServerTestCase + or util.IS_PYOPENSSL + or util.IS_SECURETRANSPORT + ): +- assert not warn.called, warn.call_args_list ++ assert not calls + else: + assert warn.called + if util.HAS_SNI: +@@ -274,6 +285,13 @@ class TestHTTPS(HTTPSDummyServerTestCase + r = https_pool.request("GET", "/") + assert r.status == 200 + ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ calls = warn.call_args_list ++ calls = [ ++ call for call in calls if call[0][1] != DeprecationWarning and ++ not call[0][0].startswith("Attempting to mutate a Context") ++ ] ++ + # Modern versions of Python, or systems using PyOpenSSL, don't + # emit warnings. + if ( +@@ -281,7 +299,7 @@ class TestHTTPS(HTTPSDummyServerTestCase + or util.IS_PYOPENSSL + or util.IS_SECURETRANSPORT + ): +- assert not warn.called, warn.call_args_list ++ assert not calls + else: + assert warn.called + if util.HAS_SNI: +@@ -306,6 +324,10 @@ class TestHTTPS(HTTPSDummyServerTestCase + assert conn.__class__ == VerifiedHTTPSConnection + + with warnings.catch_warnings(record=True) as w: ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", category=DeprecationWarning ++ ) + r = https_pool.request("GET", "/") + assert r.status == 200 + +@@ -412,6 +434,12 @@ class TestHTTPS(HTTPSDummyServerTestCase + # warnings, which we want to ignore here. + calls = warn.call_args_list + ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ calls = [ ++ call for call in calls if call[0][1] != DeprecationWarning and ++ not call[0][0].startswith("Attempting to mutate a Context") ++ ] ++ + # If we're using a deprecated TLS version we can remove 'DeprecationWarning' + if self.tls_protocol_deprecated(): + calls = [call for call in calls if call[0][1] != DeprecationWarning] +@@ -687,6 +715,11 @@ class TestHTTPS(HTTPSDummyServerTestCase + def _request_without_resource_warnings(self, method, url): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", ++ category=DeprecationWarning ++ ) + with HTTPSConnectionPool( + self.host, self.port, ca_certs=DEFAULT_CA + ) as https_pool: +@@ -742,6 +775,11 @@ class TestHTTPS(HTTPSDummyServerTestCase + conn = https_pool._get_conn() + try: + with warnings.catch_warnings(record=True) as w: ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", ++ category=DeprecationWarning ++ ) + conn.connect() + if not hasattr(conn.sock, "version"): + pytest.skip("SSLSocket.version() not available") +@@ -769,6 +807,11 @@ class TestHTTPS(HTTPSDummyServerTestCase + conn = https_pool._get_conn() + try: + with warnings.catch_warnings(record=True) as w: ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", ++ category=DeprecationWarning ++ ) + conn.connect() + finally: + conn.close() +@@ -788,6 +831,11 @@ class TestHTTPS(HTTPSDummyServerTestCase + conn = https_pool._get_conn() + try: + with warnings.catch_warnings(record=True) as w: ++ # Filter PyOpenSSL 25.1+ DeprecationWarning ++ warnings.filterwarnings( ++ "ignore", message="Attempting to mutate a Context after", ++ category=DeprecationWarning ++ ) + conn.connect() + finally: + conn.close() diff --git a/python-urllib3_1.changes b/python-urllib3_1.changes index 0dac713..84d23e4 100644 --- a/python-urllib3_1.changes +++ b/python-urllib3_1.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Aug 5 05:58:09 UTC 2025 - Steve Kowalik + +- Do not ignore deprecation warnings, the testsuite explicitly + clears all warnings multiple times. +- Add patch filter-pyopenssl-deprecationwarning.patch: + * Explicitly filter out new DeprecationWarnings raised by PyOpenSSL 25.1+ + ------------------------------------------------------------------- Thu Jul 17 20:28:07 UTC 2025 - Dirk Müller diff --git a/python-urllib3_1.spec b/python-urllib3_1.spec index 76202e6..0127f7e 100644 --- a/python-urllib3_1.spec +++ b/python-urllib3_1.spec @@ -1,7 +1,7 @@ # # spec file for package python-urllib3_1 # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -37,6 +37,8 @@ Source: https://files.pythonhosted.org/packages/source/u/urllib3/urllib3 Patch0: remove_mock.patch # PATCH-FIX-UPSTREAM CVE-2025-50181 gh#urllib3/urllib3@f05b1329126d, bsc#1244925 Patch1: CVE-2025-50181-poolmanager-redirects.patch +# PATCH-FIX-OPENSUSE Explicitly ignore new DeprecationWarning from PyOpenSSL 25.1+ +Patch2: filter-pyopenssl-deprecationwarning.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} @@ -123,8 +125,6 @@ ln -sf %{$python_sitelib}/__pycache__/six.cpython-%{$python_version_nodots}.pyc %if %{with test} %check -export PYTEST_ADDOPTS="-W ignore::DeprecationWarning" - # gh#urllib3/urllib3#2109 export CI="true" # skip some randomly failing tests (mostly on i586, but sometimes they fail on other architectures)