diff --git a/24dad62322.patch b/24dad62322.patch new file mode 100644 index 0000000..d10fb9a --- /dev/null +++ b/24dad62322.patch @@ -0,0 +1,50 @@ +From 59c0e19d7df8680e36afc96756dce72435121448 Mon Sep 17 00:00:00 2001 +From: Duncan Bellamy +Date: Sun, 17 Jan 2021 03:02:24 +0100 +Subject: [PATCH 1/2] Close streamed file in file_generator on destruct + +--- + cherrypy/lib/__init__.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/cherrypy/lib/__init__.py b/cherrypy/lib/__init__.py +index f815f76a..0edaaf20 100644 +--- a/cherrypy/lib/__init__.py ++++ b/cherrypy/lib/__init__.py +@@ -70,6 +70,11 @@ def __next__(self): + raise StopIteration() + next = __next__ + ++ def __del__(self): ++ """Close input on descturct.""" ++ if hasattr(self.input, 'close'): ++ self.input.close() ++ + + def file_generator_limited(fileobj, count, chunk_size=65536): + """Yield the given file object in chunks. + +From 4a6287b73539adcb7b0ae72d69644a1ced1f7eaa Mon Sep 17 00:00:00 2001 +From: Duncan Bellamy +Date: Fri, 15 Jan 2021 14:49:09 +0000 +Subject: [PATCH 2/2] Close hanging fd in testHandlerToolConfigOverride + +--- + cherrypy/test/test_config.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cherrypy/test/test_config.py b/cherrypy/test/test_config.py +index 5e880d87..ecd46019 100644 +--- a/cherrypy/test/test_config.py ++++ b/cherrypy/test/test_config.py +@@ -221,8 +221,8 @@ def testHandlerToolConfigOverride(self): + # the favicon in the page handler to be '../favicon.ico', + # but then overrode it in config to be './static/dirback.jpg'. + self.getPage('/favicon.ico') +- self.assertBody(open(os.path.join(localDir, 'static/dirback.jpg'), +- 'rb').read()) ++ with open(os.path.join(localDir, 'static/dirback.jpg'), 'rb') as tf: ++ self.assertBody(tf.read()) + + def test_request_body_namespace(self): + self.getPage('/plain', method='POST', headers=[ diff --git a/3bae7f0686.patch b/3bae7f0686.patch new file mode 100644 index 0000000..5d8cc2f --- /dev/null +++ b/3bae7f0686.patch @@ -0,0 +1,31 @@ +From 3bae7f06868553b006915f05ff14d86163f59a7d Mon Sep 17 00:00:00 2001 +From: Sviatoslav Sydorenko +Date: Sun, 17 Jan 2021 02:51:53 +0100 +Subject: [PATCH] Ignore pytest 6.2.0 resource warnings under py 3.8 + +Refs: +* #1897 +* https://docs.pytest.org/en/stable/usage.html#unraisable +* https://github.com/pytest-dev/pytest/issues/5299 +--- + pytest.ini | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/pytest.ini b/pytest.ini +index 909f146c..89197092 100644 +--- a/pytest.ini ++++ b/pytest.ini +@@ -33,6 +33,13 @@ addopts = + doctest_optionflags = ALLOW_UNICODE ELLIPSIS + filterwarnings = + error ++ ++ # pytest>=6.2.0 under Python 3.8: ++ # Ref: https://docs.pytest.org/en/stable/usage.html#unraisable ++ # Ref: https://github.com/pytest-dev/pytest/issues/5299 ++ ignore:Exception ignored in. :pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception ++ ignore:Exception ignored in. <_io.FileIO .closed.>:pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception ++ + ignore:Use cheroot.test.webtest:DeprecationWarning + ignore:This method will be removed in future versions.*:DeprecationWarning + ignore:Unable to verify that the server is bound on:UserWarning diff --git a/pytest-ignore-thread-DeprecationWarnings.patch b/pytest-ignore-thread-DeprecationWarnings.patch new file mode 100644 index 0000000..9e8da91 --- /dev/null +++ b/pytest-ignore-thread-DeprecationWarnings.patch @@ -0,0 +1,12 @@ +diff --git a/pytest.ini b/pytest.ini +index 8919709..771e0ae 100644 +--- a/pytest.ini ++++ b/pytest.ini +@@ -40,6 +40,7 @@ filterwarnings = + ignore:Exception ignored in. :pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception + ignore:Exception ignored in. <_io.FileIO .closed.>:pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception + ++ ignore:[gs]etName|currentThread:DeprecationWarning + ignore:Use cheroot.test.webtest:DeprecationWarning + ignore:This method will be removed in future versions.*:DeprecationWarning + ignore:Unable to verify that the server is bound on:UserWarning diff --git a/python-cherrypy.spec b/python-cherrypy.spec index 2056dff..1f53f31 100644 --- a/python-cherrypy.spec +++ b/python-cherrypy.spec @@ -10,7 +10,7 @@ Name: python-cherrypy %global camelname CherryPy Version: 18.6.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Pythonic, object-oriented web development framework License: BSD URL: http://www.cherrypy.org/ @@ -24,6 +24,16 @@ Source0: https://files.pythonhosted.org/packages/source/C/%{camelname}/%{ # removed once 3.9.1 (or newer) is packaged. Patch0: 0001.patch +# Patches backported from upstream to fix many pytest unraisable exception errors. +# However, does not fix all yet, so we use -p no:unraisableexception anyway. +# When removing the patches, also try to remove -p no:unraisableexception. +Patch1: https://github.com/cherrypy/cherrypy/commit/3bae7f0686.patch +Patch2: https://github.com/cherrypy/cherrypy/commit/24dad62322.patch + +# Ignore thread-related DeprecationWarnings new in Python 3.10 +# Temporary workaround for https://github.com/cherrypy/cherrypy/issues/1914 +Patch3: pytest-ignore-thread-DeprecationWarnings.patch + BuildArch: noarch BuildRequires: dos2unix @@ -63,8 +73,7 @@ Obsoletes: python2-cherrypy < 3.5.1 %description -n python3-cherrypy %_description %prep -%setup -q -n %{camelname}-%{version} -%patch0 -p1 +%autosetup -p1 -n %{camelname}-%{version} dos2unix cherrypy/tutorial/tutorial.conf @@ -82,8 +91,9 @@ rm cherrypy/test/test_static.py %check # https://github.com/cherrypy/cherrypy/commit/5d3c86eb36dfdf972a1d3c8d69cf8be2050eb99c export WEBTEST_INTERACTIVE=false -LANG=C.utf-8 %{__python3} -m pytest --ignore=build \ - --deselect=cherrypy/test/test_tools.py::ToolTests::testCombinedTools +%pytest cherrypy/test \ + --deselect=cherrypy/test/test_tools.py::ToolTests::testCombinedTools \ + -p no:unraisableexception %endif %files -n python3-cherrypy @@ -97,6 +107,9 @@ LANG=C.utf-8 %{__python3} -m pytest --ignore=build \ %exclude %{python3_sitelib}/cherrypy/tutorial %changelog +* Wed May 26 2021 Miro HronĨok - 18.6.0-3 +- Fix/workaround build failures with pytest 6.2 and/or Python 3.10 + * Wed Jan 27 2021 Fedora Release Engineering - 18.6.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild