15
0

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
This commit is contained in:
2021-12-20 03:11:49 +00:00
committed by Git OBS Bridge
parent 6aac473818
commit d437f65ef7
5 changed files with 80 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Sun Dec 19 21:13:43 UTC 2021 - Ben Greiner <code@bnavigator.de>
- 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 <schubi@suse.de>

View File

@@ -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)"