`aioresponses` 与 aiohttp 3.14.0 不兼容 - 请切换到 `aiointercept`
Describe the bug
The following fix https://GitHub.com/aio-libs/aiohttp/pull/12452
introduced a required field called stream_writer in the __init__ method of the public class aiohttp.client_reqrep.ClientResponse:
https://GitHub.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L219-L234
However, this breaking change has led to a bump of the minor package version: 3.13.5 => 3.14.0
This results in a lot of CI breaks accross many repos where the aiohttp bump happend automatically by dependabot to close security issue.
Is it possible to make a patch release 3.14.1 where stream_writer is an optional argument to preserve backward compatbility?
To Reproduce
Install aiohttp==3.14.0 and aioresponses==0.7.8, write a simple mock test, observe the failure:
# We need to initialize headers manually
_headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
if headers:
_headers.update(headers)
raw_headers = self._build_raw_headers(_headers)
> resp = response_class(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer'
.nox/test/lib/python3.11/site-packages/aioresponses/core.py:172: TypeErrorhttps://GitHub.com/pnuckowski/aioresponses/issues/289
Expected behavior
Bump from aiohttp==3.13.5 to aiohttp==3.14.0 must not break dependant project/packages.
Logs/tracebacks
# We need to initialize headers manually
_headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
if headers:
_headers.update(headers)
raw_headers = self._build_raw_headers(_headers)
> resp = response_class(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer'
.nox/test/lib/python3.11/site-packages/aioresponses/core.py:172: TypeErrorPython Version
$ Python --version
Python 3.11.13aiohttp Version
$ Python -m pip show aiohttp
Name: aiohttp
Version: 3.14.0
Summary: Async http client/server framework (asyncio)
Home-page: https://GitHub.com/aio-libs/aiohttp
Author:
Author-email:
License: Apache-2.0 AND MIT
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires: aiohappyeyeballs, aiosignal, attrs, frozenlist, multidict, propcache, typing_extensions, yarl
Required-by: aioresponsesmultidict Version
$ Python -m pip show multidict
Name: multidict
Version: 6.0.4
Summary: multidict implementation
Home-page: https://GitHub.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires:
Required-by:
…内容来源: aio-libs/aiohttp