From 9d8f30c9a130c7ac0d1cbab5114a87f068a96089de2227d8423aad149be919f3 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Mon, 12 Dec 2022 11:34:39 +0000 Subject: [PATCH 1/2] - Add py3109-compat.patch to make tests compatible with python 3.10.9. These tests are not present anymore in upstream master version so this patch could be removed in future releases. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-aiohttp?expand=0&rev=81 --- py3109-compat.patch | 76 ++++++++++++++++++++++++++++++++++++++++++ python-aiohttp.changes | 7 ++++ python-aiohttp.spec | 2 ++ 3 files changed, 85 insertions(+) create mode 100644 py3109-compat.patch diff --git a/py3109-compat.patch b/py3109-compat.patch new file mode 100644 index 0000000..6296bba --- /dev/null +++ b/py3109-compat.patch @@ -0,0 +1,76 @@ +Index: aiohttp-3.8.3/tests/test_client_request.py +=================================================================== +--- aiohttp-3.8.3.orig/tests/test_client_request.py ++++ aiohttp-3.8.3/tests/test_client_request.py +@@ -19,7 +19,6 @@ from aiohttp.client_reqrep import ( + Fingerprint, + _merge_ssl_params, + ) +-from aiohttp.helpers import PY_310 + from aiohttp.test_utils import make_mocked_coro + + +@@ -275,12 +274,6 @@ def test_host_header_ipv6_with_port(make + assert req.headers["HOST"] == "[::2]:99" + + +-@pytest.mark.xfail( +- PY_310, +- reason="No idea why ClientRequest() is constructed out of loop but " +- "it calls `asyncio.get_event_loop()`", +- raises=DeprecationWarning, +-) + def test_default_loop(loop) -> None: + asyncio.set_event_loop(loop) + req = ClientRequest("get", URL("http://python.org/")) +Index: aiohttp-3.8.3/tests/test_streams.py +=================================================================== +--- aiohttp-3.8.3.orig/tests/test_streams.py ++++ aiohttp-3.8.3/tests/test_streams.py +@@ -12,7 +12,6 @@ import pytest + from re_assert import Matches + + from aiohttp import streams +-from aiohttp.helpers import PY_310 + + DATA = b"line1\nline2\nline3\n" + +@@ -83,12 +82,6 @@ class TestStreamReader: + with pytest.raises(RuntimeError): + await stream._wait("test") + +- @pytest.mark.xfail( +- PY_310, +- reason="No idea why ClientRequest() is constructed out of loop but " +- "it calls `asyncio.get_event_loop()`", +- raises=DeprecationWarning, +- ) + def test_ctor_global_loop(self) -> None: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) +Index: aiohttp-3.8.3/tests/test_web_app.py +=================================================================== +--- aiohttp-3.8.3.orig/tests/test_web_app.py ++++ aiohttp-3.8.3/tests/test_web_app.py +@@ -6,7 +6,7 @@ import pytest + + from aiohttp import log, web + from aiohttp.abc import AbstractAccessLogger, AbstractRouter +-from aiohttp.helpers import DEBUG, PY_36, PY_310 ++from aiohttp.helpers import DEBUG, PY_36 + from aiohttp.test_utils import make_mocked_coro + from aiohttp.typedefs import Handler + +@@ -39,12 +39,6 @@ async def test_set_loop() -> None: + assert app.loop is loop + + +-@pytest.mark.xfail( +- PY_310, +- reason="No idea why _set_loop() is constructed out of loop " +- "but it calls `asyncio.get_event_loop()`", +- raises=DeprecationWarning, +-) + def test_set_loop_default_loop() -> None: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) diff --git a/python-aiohttp.changes b/python-aiohttp.changes index a25db23..48f44d0 100644 --- a/python-aiohttp.changes +++ b/python-aiohttp.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Dec 12 11:26:26 UTC 2022 - Daniel Garcia + +- Add py3109-compat.patch to make tests compatible with python 3.10.9. These + tests are not present anymore in upstream master version so this patch could + be removed in future releases. + ------------------------------------------------------------------- Mon Nov 7 17:49:50 UTC 2022 - Ben Greiner diff --git a/python-aiohttp.spec b/python-aiohttp.spec index 3226994..942c9c9 100644 --- a/python-aiohttp.spec +++ b/python-aiohttp.spec @@ -28,6 +28,8 @@ URL: https://github.com/aio-libs/aiohttp Source: https://files.pythonhosted.org/packages/source/a/aiohttp/aiohttp-%{version}.tar.gz # PATCH-FIX-UPSTREAM aiohttp-pr7057-bump-charset-normalizer.patch gh#aio-libs/aiohttp#7057 Patch0: aiohttp-pr7057-bump-charset-normalizer.patch +# PATCH-FIX-OPENSUSE py3109-compat.patch +Patch1: py3109-compat.patch # SECTION build requirements BuildRequires: %{python_module Cython} BuildRequires: %{python_module devel >= 3.6} From 1eb58681743c72c6539270395c126a12ee1b7a845ba12326fc290c778786ed54 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Mon, 12 Dec 2022 16:17:08 +0000 Subject: [PATCH 2/2] - Update py3109-compat.patch to work with python <= 3.10.8 too. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-aiohttp?expand=0&rev=82 --- py3109-compat.patch | 74 +++++++++++++++++++++++++----------------- python-aiohttp.changes | 5 +++ 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/py3109-compat.patch b/py3109-compat.patch index 6296bba..46633f6 100644 --- a/py3109-compat.patch +++ b/py3109-compat.patch @@ -2,7 +2,15 @@ Index: aiohttp-3.8.3/tests/test_client_request.py =================================================================== --- aiohttp-3.8.3.orig/tests/test_client_request.py +++ aiohttp-3.8.3/tests/test_client_request.py -@@ -19,7 +19,6 @@ from aiohttp.client_reqrep import ( +@@ -2,6 +2,7 @@ import asyncio + import hashlib + import io + import os.path ++import sys + import urllib.parse + import zlib + from http.cookies import BaseCookie, Morsel, SimpleCookie +@@ -19,7 +20,6 @@ from aiohttp.client_reqrep import ( Fingerprint, _merge_ssl_params, ) @@ -10,24 +18,28 @@ Index: aiohttp-3.8.3/tests/test_client_request.py from aiohttp.test_utils import make_mocked_coro -@@ -275,12 +274,6 @@ def test_host_header_ipv6_with_port(make - assert req.headers["HOST"] == "[::2]:99" +@@ -276,7 +276,7 @@ def test_host_header_ipv6_with_port(make --@pytest.mark.xfail( + @pytest.mark.xfail( - PY_310, -- reason="No idea why ClientRequest() is constructed out of loop but " -- "it calls `asyncio.get_event_loop()`", -- raises=DeprecationWarning, --) - def test_default_loop(loop) -> None: - asyncio.set_event_loop(loop) - req = ClientRequest("get", URL("http://python.org/")) ++ sys.version_info >= (3, 10) and sys.version_info < (3, 10, 9), + reason="No idea why ClientRequest() is constructed out of loop but " + "it calls `asyncio.get_event_loop()`", + raises=DeprecationWarning, Index: aiohttp-3.8.3/tests/test_streams.py =================================================================== --- aiohttp-3.8.3.orig/tests/test_streams.py +++ aiohttp-3.8.3/tests/test_streams.py -@@ -12,7 +12,6 @@ import pytest +@@ -4,6 +4,7 @@ import abc + import asyncio + import gc + import types ++import sys + from collections import defaultdict + from itertools import groupby + from unittest import mock +@@ -12,7 +13,6 @@ import pytest from re_assert import Matches from aiohttp import streams @@ -35,24 +47,26 @@ Index: aiohttp-3.8.3/tests/test_streams.py DATA = b"line1\nline2\nline3\n" -@@ -83,12 +82,6 @@ class TestStreamReader: - with pytest.raises(RuntimeError): +@@ -84,7 +84,7 @@ class TestStreamReader: await stream._wait("test") -- @pytest.mark.xfail( + @pytest.mark.xfail( - PY_310, -- reason="No idea why ClientRequest() is constructed out of loop but " -- "it calls `asyncio.get_event_loop()`", -- raises=DeprecationWarning, -- ) - def test_ctor_global_loop(self) -> None: - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) ++ sys.version_info >= (3, 10) and sys.version_info < (3, 10, 9), + reason="No idea why ClientRequest() is constructed out of loop but " + "it calls `asyncio.get_event_loop()`", + raises=DeprecationWarning, Index: aiohttp-3.8.3/tests/test_web_app.py =================================================================== --- aiohttp-3.8.3.orig/tests/test_web_app.py +++ aiohttp-3.8.3/tests/test_web_app.py -@@ -6,7 +6,7 @@ import pytest +@@ -1,12 +1,13 @@ + import asyncio + import gc ++import sys + from unittest import mock + + import pytest from aiohttp import log, web from aiohttp.abc import AbstractAccessLogger, AbstractRouter @@ -61,16 +75,16 @@ Index: aiohttp-3.8.3/tests/test_web_app.py from aiohttp.test_utils import make_mocked_coro from aiohttp.typedefs import Handler -@@ -39,12 +39,6 @@ async def test_set_loop() -> None: - assert app.loop is loop +@@ -40,9 +41,9 @@ async def test_set_loop() -> None: --@pytest.mark.xfail( + @pytest.mark.xfail( - PY_310, - reason="No idea why _set_loop() is constructed out of loop " - "but it calls `asyncio.get_event_loop()`", -- raises=DeprecationWarning, --) ++ sys.version_info >= (3, 10) and sys.version_info < (3, 10, 9), ++ reason="No idea why ClientRequest() is constructed out of loop but " ++ "it calls `asyncio.get_event_loop()`", + raises=DeprecationWarning, + ) def test_set_loop_default_loop() -> None: - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) diff --git a/python-aiohttp.changes b/python-aiohttp.changes index 48f44d0..95d2922 100644 --- a/python-aiohttp.changes +++ b/python-aiohttp.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 12 16:16:31 UTC 2022 - Daniel Garcia + +- Update py3109-compat.patch to work with python <= 3.10.8 too. + ------------------------------------------------------------------- Mon Dec 12 11:26:26 UTC 2022 - Daniel Garcia