Python 3.11: Deselect fewer tests

This partially reverts commit 500b86a004.
This commit is contained in:
Miro Hrončok 2022-06-16 12:10:43 +02:00
parent 8b31f62d1a
commit 049602ac03
2 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,29 @@
From 19d8c96aea383b7856e46cd285e52428a56a207b Mon Sep 17 00:00:00 2001
From: Thomas Grainger <tagrain@gmail.com>
Date: Thu, 16 Jun 2022 11:07:28 +0100
Subject: [PATCH] set the global event loop in _setupAsyncioRunner
---
aiohttp/test_utils.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/aiohttp/test_utils.py b/aiohttp/test_utils.py
index 82956986b9..510e35e363 100644
--- a/aiohttp/test_utils.py
+++ b/aiohttp/test_utils.py
@@ -412,6 +412,15 @@ class AioHTTPTestCase(TestCase):
Note that the TestClient's methods are asynchronous: you have to
execute function on the test client using asynchronous methods.
"""
+ def _setupAsyncioRunner(self):
+ super()._setupAsyncioRunner()
+ asyncio.set_event_loop(self._asyncioRunner.get_loop())
+
+ def _tearDownAsyncioRunner(self):
+ try:
+ super()._tearDownAsyncioRunner()
+ finally:
+ asyncio.set_event_loop(None)
async def get_application(self) -> Application:
"""Get application.

View File

@ -4,7 +4,7 @@
Name: python-%{srcname}
Version: 3.8.1
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Python HTTP client/server for asyncio
License: ASL 2.0
@ -17,6 +17,8 @@ Patch: 0001-Unbundle-llhttp.patch
Patch: 0002-Fix-pytest.warns-None-usage-deprecated-in-pytest-7-6.patch
# https://github.com/aio-libs/aiohttp/pull/6734
Patch: 0003-Stop-using-the-cgi-module-deprecated-in-Python-3.11.patch
# https://github.com/aio-libs/aiohttp/commit/19d8c96aea383b7856e46cd285e52428a56a207b
Patch: 0004-Set-the-global-event-loop-in-setupAsyncioRunner.patch
BuildRequires: gcc
@ -93,10 +95,9 @@ cython -3 aiohttp/*.pyx -I aiohttp
%check
# test_proxy_functional.py requires python3dist(proxy-py)
# test_client_session_timeout_zero requires DNS
# reading_headers, test_data_stream_exc_chain, TestCase::test_default_loop,
# test_on_startup_hook, TestAioHTTPTestCase -- see https://github.com/aio-libs/aiohttp/issues/6757
# the 3 pyloop tests are still failing with 3.11, TODO report and investigate
%pytest --ignore=tests/test_proxy_functional.py \
-k 'not test_client_session_timeout_zero and not reading_headers and not test_data_stream_exc_chain and not (TestCase and test_default_loop) and not test_on_startup_hook and not TestAioHTTPTestCase'
-k 'not test_client_session_timeout_zero and not (pyloop and ((test_timeout_on and _headers) or test_data_stream_exc_chain))'
%endif
%files -n python3-%{srcname}
@ -107,6 +108,9 @@ cython -3 aiohttp/*.pyx -I aiohttp
%exclude %{python3_sitearch}/examples/
%changelog
* Thu Jun 16 2022 Miro Hrončok <mhroncok@redhat.com> - 3.8.1-6
- Skip less tests, set the global event loop in _setupAsyncioRunner
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 3.8.1-5
- Rebuilt for Python 3.11