From 5f64e0de53064c23aeb254fc705ead1f0a9526d2d5a0cebaa0c3d08dd650c44b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 24 Oct 2024 19:24:58 +0000 Subject: [PATCH] - add handle-openssl3-error-in-ssl-tests.patch: support openssl 3.2+ - avoid deprecation warnings for 3.13 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cheroot?expand=0&rev=65 --- handle-openssl3-error-in-ssl-tests.patch | 72 ++++++++++++++++++++++++ no-pypytools.patch | 12 ++-- python-cheroot.changes | 7 +++ python-cheroot.spec | 4 +- 4 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 handle-openssl3-error-in-ssl-tests.patch diff --git a/handle-openssl3-error-in-ssl-tests.patch b/handle-openssl3-error-in-ssl-tests.patch new file mode 100644 index 0000000..d101ea6 --- /dev/null +++ b/handle-openssl3-error-in-ssl-tests.patch @@ -0,0 +1,72 @@ +From 6d0a7403a6cdf4041d1a3f388dc60b2b95e5e857 Mon Sep 17 00:00:00 2001 +From: Dan Radez +Date: Tue, 2 Apr 2024 10:33:42 -0400 +Subject: [PATCH] handle openssl3 error in ssl tests + +Using OpenSSL 3, the expected error string caught in ssl tests has changed. +E AssertionError: assert 'wrong version number' in + '[SSL] record layer failure (_ssl.c:1000)' + +This is already handled for OpenSSL pre-1.1 and gte-1.1, adding handling +for OpenSSL 3+ + +Fixes: #645 +--- + cheroot/_compat.py | 2 ++ + cheroot/_compat.pyi | 1 + + cheroot/test/test_ssl.py | 7 ++++--- + 3 files changed, 7 insertions(+), 3 deletions(-) + +Index: cheroot-10.0.1/cheroot/_compat.py +=================================================================== +--- cheroot-10.0.1.orig/cheroot/_compat.py ++++ cheroot-10.0.1/cheroot/_compat.py +@@ -8,9 +8,11 @@ import platform + try: + import ssl + IS_ABOVE_OPENSSL10 = ssl.OPENSSL_VERSION_INFO >= (1, 1) ++ IS_ABOVE_OPENSSL31 = ssl.OPENSSL_VERSION_INFO >= (3, 2) + del ssl + except ImportError: + IS_ABOVE_OPENSSL10 = None ++ IS_ABOVE_OPENSSL31 = None + + + IS_CI = bool(os.getenv('CI')) +Index: cheroot-10.0.1/cheroot/_compat.pyi +=================================================================== +--- cheroot-10.0.1.orig/cheroot/_compat.pyi ++++ cheroot-10.0.1/cheroot/_compat.pyi +@@ -3,6 +3,7 @@ from typing import Any, ContextManager, + def suppress(*exceptions: Type[BaseException]) -> ContextManager[None]: ... + + IS_ABOVE_OPENSSL10: Optional[bool] ++IS_ABOVE_OPENSSL31: Optional[bool] + IS_CI: bool + IS_GITHUB_ACTIONS_WORKFLOW: bool + IS_PYPY: bool +Index: cheroot-10.0.1/cheroot/test/test_ssl.py +=================================================================== +--- cheroot-10.0.1.orig/cheroot/test/test_ssl.py ++++ cheroot-10.0.1/cheroot/test/test_ssl.py +@@ -17,7 +17,7 @@ import requests + import trustme + + from cheroot._compat import bton, ntob, ntou +-from cheroot._compat import IS_ABOVE_OPENSSL10, IS_CI, IS_PYPY ++from cheroot._compat import IS_ABOVE_OPENSSL10, IS_ABOVE_OPENSSL31, IS_CI, IS_PYPY + from cheroot._compat import IS_LINUX, IS_MACOS, IS_WINDOWS + from cheroot.server import HTTPServer, get_ssl_adapter_class + from cheroot.testing import ( +@@ -597,8 +597,9 @@ def test_https_over_http_error(http_serv + ), + ).request('GET', '/') + expected_substring = ( +- 'wrong version number' if IS_ABOVE_OPENSSL10 +- else 'unknown protocol' ++ 'record layer failure' if IS_ABOVE_OPENSSL31 ++ else 'wrong version number' if IS_ABOVE_OPENSSL10 ++ else 'unknown protocol' + ) + assert expected_substring in ssl_err.value.args[-1] + diff --git a/no-pypytools.patch b/no-pypytools.patch index b5119e5..f4281bb 100644 --- a/no-pypytools.patch +++ b/no-pypytools.patch @@ -2,11 +2,11 @@ cheroot/test/test_server.py | 13 ------------- 1 file changed, 13 deletions(-) -Index: cheroot-9.0.0/cheroot/test/test_server.py +Index: cheroot-10.0.1/cheroot/test/test_server.py =================================================================== ---- cheroot-9.0.0.orig/cheroot/test/test_server.py -+++ cheroot-9.0.0/cheroot/test/test_server.py -@@ -12,8 +12,6 @@ import pytest +--- cheroot-10.0.1.orig/cheroot/test/test_server.py ++++ cheroot-10.0.1/cheroot/test/test_server.py +@@ -13,8 +13,6 @@ import pytest import requests import requests_unixsocket @@ -15,7 +15,7 @@ Index: cheroot-9.0.0/cheroot/test/test_server.py from .._compat import bton, ntob from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS, SYS_PLATFORM from ..server import IS_UID_GID_RESOLVABLE, Gateway, HTTPServer -@@ -380,13 +378,6 @@ if not IS_WINDOWS and not ISSUE511: +@@ -410,13 +408,6 @@ if not IS_WINDOWS and not ISSUE511: @pytest.fixture @@ -29,7 +29,7 @@ Index: cheroot-9.0.0/cheroot/test/test_server.py def resource_limit(request): """Set the resource limit two times bigger then requested.""" resource = pytest.importorskip( -@@ -415,11 +406,6 @@ def resource_limit(request): +@@ -445,11 +436,6 @@ def resource_limit(request): @pytest.fixture def many_open_sockets(request, resource_limit): """Allocate a lot of file descriptors by opening dummy sockets.""" diff --git a/python-cheroot.changes b/python-cheroot.changes index 97548ba..5d1ac3e 100644 --- a/python-cheroot.changes +++ b/python-cheroot.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 24 19:24:31 UTC 2024 - Dirk Müller + +- add handle-openssl3-error-in-ssl-tests.patch: + support openssl 3.2+ +- avoid deprecation warnings for 3.13 + ------------------------------------------------------------------- Wed May 22 13:36:38 UTC 2024 - Markéta Machová diff --git a/python-cheroot.spec b/python-cheroot.spec index 1e2ea1d..e9eba8d 100644 --- a/python-cheroot.spec +++ b/python-cheroot.spec @@ -40,6 +40,8 @@ Patch0: no-pypytools.patch Patch1: no-relative-imports.patch # PATCH-FIX-SUSE increase-tests-timeouts.patch alarrosa@suse.com Tests take longer to run in s390x Patch2: increase-tests-timeouts.patch +# handle openssl3 error in ssl tests +Patch3: handle-openssl3-error-in-ssl-tests.patch BuildRequires: %{python_module base >= 3.6} BuildRequires: %{python_module importlib-metadata if %python-base < 3.8} BuildRequires: %{python_module jaraco.functools} @@ -115,7 +117,7 @@ donttest="(test_tls_client_auth and False-localhost-builtin)" donttest+=" or test_high_number_of_file_descriptor" # Openssl 3.2 test failures gh#cherrypy/cheroot#645 donttest+=" or test_https_over_http_error" -%pytest --pyargs cheroot $pytest_opts -k "not ($donttest)" +%pytest --pyargs cheroot $pytest_opts -k "not ($donttest)" -W ignore::DeprecationWarning -p no:unraisableexception popd %pre