aio-libs / aio-libs/aiohttp

`aioresponses` is incompatible with aiohttp 3.14.0 - switch to `aiointercept`

Abierto
#12,815 11 comentarios 7 reacciones 0 asignados Ver en GitHub
invalid question
Lenguaje dominante
Python
Estrellas
16.5k
Forks
2.4k
Merge medio
17 h 22 min
PR fusionados (30 d)
212

Descripción

### Describe the bug

The folowing 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:

```text

# 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: TypeError
```

https://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

```python-traceback
# 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: TypeError
```

### Python Version

```console
$ python --version
Python 3.11.13
```

### aiohttp Version

```console
$ 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: aioresponses
```

### multidict Version

```console
$ 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: andrew.svetlov@gmail.com
License: Apache 2
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires:
Required-by: aiohttp, yarl
```

### propcache Version

```console
$ python -m pip show propcache
Name: propcache
Version: 0.2.0
Summary: Accelerated property cache
Home-page: https://github.com/aio-libs/propcache
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache-2.0
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires:
Required-by: aiohttp, yarl
```

### yarl Version

```console
$ python -m pip show yarl
Name: yarl
Version: 1.17.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache-2.0
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires: idna, multidict, propcache
Required-by: aiohttp
```

### OS

macOS

### Related component

Client

### Additional context

_No response_

### Code of Conduct

- [x] I agree to follow the aio-libs Code of Conduct

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.