From d437f65ef7c9c7479fc287cc9ea0cc983d293fd72bec988a114a81a40e394c5d Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 20 Dec 2021 03:11:49 +0000 Subject: [PATCH] Accepting request 941543 from home:bnavigator:python-rpm-macros - Add patches fixing test suite failures due to Python 3.10 deprecations: * cheroot-pr370-py310-threaddeprecations.patch * cheroot-pr371-py310-threaddeprecations.patch * cheroot-c0b1b167-py310-threaddeprecations.patch - Skip threadexceptions plugin for Pytest 6.2 OBS-URL: https://build.opensuse.org/request/show/941543 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cheroot?expand=0&rev=39 --- ...ot-c0b1b167-py310-threaddeprecations.patch | 13 +++++++ cheroot-pr370-py310-threaddeprecations.patch | 13 +++++++ cheroot-pr371-py310-threaddeprecations.patch | 37 +++++++++++++++++++ python-cheroot.changes | 10 +++++ python-cheroot.spec | 9 ++++- 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 cheroot-c0b1b167-py310-threaddeprecations.patch create mode 100644 cheroot-pr370-py310-threaddeprecations.patch create mode 100644 cheroot-pr371-py310-threaddeprecations.patch diff --git a/cheroot-c0b1b167-py310-threaddeprecations.patch b/cheroot-c0b1b167-py310-threaddeprecations.patch new file mode 100644 index 0000000..19f5321 --- /dev/null +++ b/cheroot-c0b1b167-py310-threaddeprecations.patch @@ -0,0 +1,13 @@ +diff --git a/cheroot/server.py b/cheroot/server.py +index 8b59a33af..10153dde3 100644 +--- a/cheroot/server.py ++++ b/cheroot/server.py +@@ -1841,7 +1841,7 @@ def _run_in_thread(self): + """Context manager for running this server in a thread.""" + self.prepare() + thread = threading.Thread(target=self.serve) +- thread.setDaemon(True) ++ thread.daemon = True + thread.start() + try: + yield thread diff --git a/cheroot-pr370-py310-threaddeprecations.patch b/cheroot-pr370-py310-threaddeprecations.patch new file mode 100644 index 0000000..962ecae --- /dev/null +++ b/cheroot-pr370-py310-threaddeprecations.patch @@ -0,0 +1,13 @@ +diff --git a/cheroot/workers/threadpool.py b/cheroot/workers/threadpool.py +index 915934cce..57e6588dd 100644 +--- a/cheroot/workers/threadpool.py ++++ b/cheroot/workers/threadpool.py +@@ -320,7 +320,7 @@ def _clear_threads(self): + return ( + thread + for thread in threads +- if thread is not threading.currentThread() ++ if thread is not threading.current_thread() + ) + + @property diff --git a/cheroot-pr371-py310-threaddeprecations.patch b/cheroot-pr371-py310-threaddeprecations.patch new file mode 100644 index 0000000..736f3a2 --- /dev/null +++ b/cheroot-pr371-py310-threaddeprecations.patch @@ -0,0 +1,37 @@ +diff --git a/cheroot/workers/threadpool.py b/cheroot/workers/threadpool.py +index 57e6588dd..6305085de 100644 +--- a/cheroot/workers/threadpool.py ++++ b/cheroot/workers/threadpool.py +@@ -108,7 +108,7 @@ def run(self): + + Retrieves incoming connections from thread pool. + """ +- self.server.stats['Worker Threads'][self.getName()] = self.stats ++ self.server.stats['Worker Threads'][self.name] = self.stats + try: + self.ready = True + while True: +@@ -176,9 +176,9 @@ def start(self): + for i in range(self.min): + self._threads.append(WorkerThread(self.server)) + for worker in self._threads: +- worker.setName( ++ worker.name = ( + 'CP Server {worker_name!s}'. +- format(worker_name=worker.getName()), ++ format(worker_name=worker.name), + ) + worker.start() + for worker in self._threads: +@@ -226,9 +226,9 @@ def grow(self, amount): + + def _spawn_worker(self): + worker = WorkerThread(self.server) +- worker.setName( ++ worker.name = ( + 'CP Server {worker_name!s}'. +- format(worker_name=worker.getName()), ++ format(worker_name=worker.name), + ) + worker.start() + return worker diff --git a/python-cheroot.changes b/python-cheroot.changes index 748a2df..5a0261a 100644 --- a/python-cheroot.changes +++ b/python-cheroot.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sun Dec 19 21:13:43 UTC 2021 - Ben Greiner + +- Add patches fixing test suite failures due to Python 3.10 + deprecations: + * cheroot-pr370-py310-threaddeprecations.patch + * cheroot-pr371-py310-threaddeprecations.patch + * cheroot-c0b1b167-py310-threaddeprecations.patch +- Skip threadexceptions plugin for Pytest 6.2 + ------------------------------------------------------------------- Tue Oct 5 13:46:46 UTC 2021 - Stefan Schubert diff --git a/python-cheroot.spec b/python-cheroot.spec index 5ba5970..eb64401 100644 --- a/python-cheroot.spec +++ b/python-cheroot.spec @@ -1,5 +1,5 @@ # -# spec file for package python-cheroot +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -33,6 +33,9 @@ Summary: Pure-python HTTP server License: BSD-3-Clause URL: https://github.com/cherrypy/cheroot Source: https://files.pythonhosted.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz +Patch0: https://github.com/cherrypy/cheroot/pull/370.diff#/cheroot-pr370-py310-threaddeprecations.patch +Patch1: https://github.com/cherrypy/cheroot/pull/371.diff#/cheroot-pr371-py310-threaddeprecations.patch +Patch2: https://github.com/cherrypy/cheroot/commit/0b16749ecdfa064315fc7908f6865071fc33d778.diff#/cheroot-c0b1b167-py310-threaddeprecations.patch BuildRequires: %{python_module jaraco.functools} BuildRequires: %{python_module more-itertools >= 2.6} BuildRequires: %{python_module setuptools >= 34.4} @@ -88,7 +91,7 @@ Requires: python-selectors2 Cheroot is the pure-Python HTTP server used by CherryPy. %prep -%autosetup -n cheroot-%{version} -p1 +%autosetup -p1 -n cheroot-%{version} -p1 # do not check coverage sed -i '/--cov/ d' pytest.ini @@ -106,6 +109,8 @@ sed -i '/--cov/ d' pytest.ini # do not want to add python-jaraco.context to Ring1 pytest_opts="--ignore cheroot/test/test_wsgi.py" %endif +# https://github.com/cherrypy/cheroot/issues/355 +pytest_opts+=" -p no:threadexception" # test_tls_client_auth[...-False-localhost-builtin] fails ocassionally on server-side OBS %pytest $pytest_opts -k "not (test_tls_client_auth and False-localhost-builtin)"