Skip to content

Commit 6fdc8b3

Browse files
JWCookalessio-locatelli
authored andcommitted
Update test fixture for compatibility with both aiohttp 3.14 and <=3.13
1 parent cae0134 commit 6fdc8b3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎test/unit/test_session.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from http.cookies import SimpleCookie
44
from unittest.mock import AsyncMock, MagicMock, patch
55

6+
import aiohttp
67
import pytest
78
from aiohttp import ClientResponse
89
from yarl import URL
@@ -13,7 +14,8 @@
1314

1415
pytestmark = [pytest.mark.asyncio]
1516

16-
17+
aiohttp_314 = tuple(int(x) for x in aiohttp.__version__.split('.')[:2]) >= (3, 14)
18+
extra_args = {'stream_writer': MagicMock()} if aiohttp_314 else {}
1719
FakeCachedResponse = CachedResponse(method='GET', reason='OK', status=200, url='url', version='1.1')
1820
FakeClientResponse = ClientResponse(
1921
method='GET',
@@ -26,6 +28,7 @@
2628
# loop=asyncio.get_event_loop(),
2729
loop=MagicMock(),
2830
session=None, # type: ignore[arg-type]
31+
**extra_args, # type: ignore[arg-type]
2932
)
3033

3134

0 commit comments

Comments
 (0)