From dce109b98117d79c07568f4ddf24998fe72839a0 Mon Sep 17 00:00:00 2001 From: Cagri Yonca Date: Tue, 15 Jul 2025 17:35:04 +0200 Subject: [PATCH] fix(aiohttp): remove support for older versions of aiohttp Co-authored-by: Paulo Vital Signed-off-by: Cagri Yonca --- tests/conftest.py | 52 +++++++++++++++++++++++++++++------------- tests/requirements.txt | 3 +-- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4f890b01..98bf8f67 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,10 +34,12 @@ # ppc64le and s390x have limitations with some supported libraries. machine, py_version = get_runtime_env_info() if machine in ["ppc64le", "s390x"]: - collect_ignore_glob.extend([ - "*test_google-cloud*", - "*test_pymongo*", - ]) + collect_ignore_glob.extend( + [ + "*test_google-cloud*", + "*test_pymongo*", + ] + ) if machine == "ppc64le": collect_ignore_glob.append("*test_grpcio*") @@ -51,28 +53,44 @@ collect_ignore_glob.append("*test_couchbase*") if not os.environ.get("GEVENT_STARLETTE_TEST"): - collect_ignore_glob.extend([ - "*test_gevent*", - "*test_starlette*", - ]) + collect_ignore_glob.extend( + [ + "*test_gevent*", + "*test_starlette*", + ] + ) if not os.environ.get("KAFKA_TEST"): collect_ignore_glob.append("*kafka/test*") +# Currently asyncio and tornado_server depends on aiohttp and +# since aiohttp versions < 3.12.14 have vulnerability we skip the tests below +if sys.version_info < (3, 9): + collect_ignore_glob.extend( + [ + "*test_aiohttp*", + "*test_asyncio*", + "*test_tornado_server*", + ] + ) + if sys.version_info >= (3, 12): # Currently Spyne does not support python > 3.12 collect_ignore_glob.append("*test_spyne*") if sys.version_info >= (3, 14): - collect_ignore_glob.extend([ - # Currently not installable dependencies because of 3.14 incompatibilities - "*test_fastapi*", - # aiohttp-server tests failing due to deprecated methods used - "*test_aiohttp_server*", - # Currently Sanic does not support python >= 3.14 - "*test_sanic*", - ]) + collect_ignore_glob.extend( + [ + # Currently not installable dependencies because of 3.14 incompatibilities + "*test_fastapi*", + # aiohttp-server tests failing due to deprecated methods used + "*test_aiohttp_server*", + # Currently Sanic does not support python >= 3.14 + "*test_sanic*", + ] + ) + @pytest.fixture(scope="session") def celery_config(): @@ -253,10 +271,12 @@ def announce(monkeypatch, request) -> None: else: monkeypatch.setattr(HostAgent, "announce", always_true) + # Mocking the import of uwsgi def _uwsgi_masterpid() -> int: return 12345 + module = type(sys)("uwsgi") module.opt = { "master": True, diff --git a/tests/requirements.txt b/tests/requirements.txt index f1090c06..48afb6a9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,8 +1,7 @@ -r requirements-minimal.txt aioamqp>=0.15.0 aiofiles>=0.5.0 -aiohttp<=3.10.11; python_version <= "3.8" -aiohttp>=3.8.3; python_version > "3.8" +aiohttp>=3.12.14; python_version >= "3.9" aio-pika>=9.5.2 boto3>=1.17.74 bottle>=0.12.25