From 0555866bc34a1f0e66fd2a77f00e74d1f8ac60a1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 22 Jun 2026 11:00:13 -0500 Subject: [PATCH] test: switch from aioresponses to aiointercept aioresponses breaks on aiohttp 3.14 because it instantiates the internal ClientResponse directly; aiointercept routes through a real test server, so it survives aiohttp internals changing. See aio-libs/aiohttp#12815. --- poetry.lock | 23 ++++++++++++----------- pyproject.toml | 2 +- tests/test_init.py | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/poetry.lock b/poetry.lock index 9914ab2..146d377 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. [[package]] name = "accessible-pygments" @@ -176,20 +176,21 @@ yarl = ">=1.17.0,<2.0" speedups = ["Brotli (>=1.2) ; platform_python_implementation == \"CPython\"", "aiodns (>=3.3.0)", "backports.zstd ; platform_python_implementation == \"CPython\" and python_version < \"3.14\"", "brotlicffi (>=1.2) ; platform_python_implementation != \"CPython\""] [[package]] -name = "aioresponses" -version = "0.7.8" -description = "Mock out requests made by ClientSession from aiohttp package" +name = "aiointercept" +version = "0.1.7" +description = "aiohttp mock library that routes requests through a real test server" optional = false -python-versions = "*" +python-versions = ">=3.10" groups = ["dev"] files = [ - {file = "aioresponses-0.7.8-py2.py3-none-any.whl", hash = "sha256:b73bd4400d978855e55004b23a3a84cb0f018183bcf066a85ad392800b5b9a94"}, - {file = "aioresponses-0.7.8.tar.gz", hash = "sha256:b861cdfe5dc58f3b8afac7b0a6973d5d7b2cb608dd0f6253d16b8ee8eaf6df11"}, + {file = "aiointercept-0.1.7-py3-none-any.whl", hash = "sha256:953d3c2d27e93e710d655ea47d191376e2966ca432a99fcfe2c780f9965e1212"}, + {file = "aiointercept-0.1.7.tar.gz", hash = "sha256:b9681ec590457e062159c8bdb1d77f17b9a80521a95c779010d55bd8c5d585cc"}, ] [package.dependencies] -aiohttp = ">=3.3.0,<4.0.0" -packaging = ">=22.0" +aiohttp = ">=3.13.3,<4.0.0" +multidict = ">=6.0,<7.0" +yarl = ">=1.23.0,<2.0.0" [[package]] name = "aiosignal" @@ -708,7 +709,7 @@ accessible-pygments = ">=0.0.5" beautifulsoup4 = "*" pygments = ">=2.7" sphinx = ">=7.0,<10.0" -sphinx-basic-ng = ">=1.0.0b2" +sphinx-basic-ng = ">=1.0.0.beta2" [[package]] name = "h11" @@ -1937,4 +1938,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = "^3.10" -content-hash = "031caa542d2b50f6015b3e3e0d1d98fed05390be0bce3cb578c7314fc634daf5" +content-hash = "6ffb8fccdcff5684af307e6c8f04a6ffa93c455b6708c3f8cf2f8643fbc78780" diff --git a/pyproject.toml b/pyproject.toml index 031b57f..8040452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ yarl = ">=1.9.0" pytest = ">=7,<10" pytest-cov = ">=3,<8" pytest-asyncio = ">=0.23.6,<1.4.0" -aioresponses = "^0.7.6" +aiointercept = "^0.1.7" [tool.poetry.group.docs] optional = true diff --git a/tests/test_init.py b/tests/test_init.py index 9eeba45..e523d46 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -3,7 +3,7 @@ import aiohttp import pytest -from aioresponses import aioresponses +from aiointercept import aiointercept from aiosolaredge import SolarEdge @@ -33,7 +33,7 @@ async def test_create_object_passed_session(): @pytest.mark.asyncio async def test_simple_requests() -> None: """Creating an object works as expected.""" - with aioresponses() as mocked: + async with aiointercept(mock_external_urls=True) as mocked: solar_edge = SolarEdge("API_KEY") assert solar_edge.timeout == 10 assert solar_edge.api_key == "API_KEY"