chore(deps): update dependency aiohttp to v3.14.0 #101
2 changed files with 46 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
aiohappyeyeballs==2.6.1
|
||||
aiohttp==3.13.5
|
||||
aiohttp==3.14.0
|
||||
aiosignal==1.4.0
|
||||
annotated-types==0.7.0
|
||||
anyio==4.13.0
|
||||
|
|
|
|||
|
|
@ -24,6 +24,51 @@ import aiohttp
|
|||
import httpx
|
||||
import pytest
|
||||
|
||||
# ── Patch aioresponses for aiohttp 3.14.0 compatibility ──────────────────────
|
||||
# aiohttp 3.14.0 added a required `stream_writer` parameter to
|
||||
# `ClientResponse.__init__()`. The released `aioresponses==0.7.8` does not pass
|
||||
# this argument, causing:
|
||||
# TypeError: ClientResponse.__init__() missing 1 required keyword-only argument:
|
||||
# 'stream_writer'
|
||||
#
|
||||
# We monkey-patch `ClientResponse.__init__` to accept `stream_writer` with a
|
||||
# default value when called from aioresponses (i.e. when `writer` is None).
|
||||
|
||||
try:
|
||||
from aiohttp.client_reqrep import ClientResponse
|
||||
|
||||
_ClientResponse__init__ = ClientResponse.__init__
|
||||
|
||||
def _patched_client_response_init(
|
||||
self,
|
||||
method,
|
||||
url,
|
||||
*,
|
||||
writer,
|
||||
continue100,
|
||||
timer,
|
||||
request_info,
|
||||
traces,
|
||||
loop,
|
||||
session,
|
||||
stream_writer=None, # type: ignore[assignment]
|
||||
):
|
||||
# If stream_writer was not provided (aioresponses 0.7.8), create a mock.
|
||||
# When writer is None (mocked response), stream_writer.output_size is read.
|
||||
if writer is None and stream_writer is None:
|
||||
mock_writer = MagicMock()
|
||||
mock_writer.output_size = 0
|
||||
stream_writer = mock_writer
|
||||
return _ClientResponse__init__(
|
||||
self, method, url, writer=writer, continue100=continue100,
|
||||
timer=timer, request_info=request_info, traces=traces,
|
||||
loop=loop, session=session, stream_writer=stream_writer,
|
||||
)
|
||||
|
||||
ClientResponse.__init__ = _patched_client_response_init # type: ignore[assignment]
|
||||
except Exception:
|
||||
pass # If patching fails, tests will fail with a clear TypeError instead
|
||||
|
||||
_TEST_DIR = Path(__file__).parent
|
||||
# Must be set before importing router so module-level Config.from_yaml + Config field
|
||||
# defaults pick these up. db_path is intentionally absent from config_test.yaml so the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue