Skip to content

Commit 15a0fa8

Browse files
committed
Fixes
1 parent f4ebcb7 commit 15a0fa8

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

tests/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations # TODO(PY311): Remove
2+
13
import asyncio
24
import base64
35
import os
@@ -18,7 +20,6 @@
1820
Optional,
1921
TypedDict,
2022
Union,
21-
Unpack,
2223
)
2324
from unittest import mock
2425
from uuid import uuid4
@@ -69,6 +70,11 @@
6970
except ImportError:
7071
uvloop = None # type: ignore[assignment]
7172

73+
if sys.version_info >= (3, 11):
74+
from typing import Unpack
75+
else:
76+
from typing import Any as Unpack
77+
7278

7379
pytest_plugins = ("aiohttp.pytest_plugin", "pytester")
7480

tests/test_benchmarks_client_request.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import asyncio
44
from http.cookies import BaseCookie
5-
from typing import Any, Callable, Union, Unpack
5+
from typing import Any, Callable, Union
66

77
from multidict import CIMultiDict
88
from pytest_codspeed import BenchmarkFixture
@@ -14,6 +14,13 @@
1414
from aiohttp.http_writer import HttpVersion11
1515
from aiohttp.tracing import Trace
1616

17+
if sys.version_info >= (3, 11):
18+
from typing import Unpack
19+
20+
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
21+
else:
22+
_RequestMaker = Any
23+
1724

1825
def test_client_request_update_cookies(
1926
loop: asyncio.AbstractEventLoop,

tests/test_client_request.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Optional,
1717
Protocol,
1818
Union,
19-
Unpack,
2019
)
2120
from unittest import mock
2221

@@ -44,7 +43,12 @@
4443
from aiohttp.multipart import MultipartWriter
4544
from aiohttp.typedefs import LooseCookies
4645

47-
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
46+
if sys.version_info >= (3, 11):
47+
from typing import Unpack
48+
49+
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
50+
else:
51+
_RequestMaker = Any
4852

4953

5054
class WriterMock(mock.AsyncMock):

tests/test_connector.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
Optional,
2626
Sequence,
2727
Tuple,
28-
Unpack,
2928
)
3029
from unittest import mock
3130

@@ -61,7 +60,12 @@
6160
from aiohttp.test_utils import unused_port
6261
from aiohttp.tracing import Trace
6362

64-
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
63+
if sys.version_info >= (3, 11):
64+
from typing import Unpack
65+
66+
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
67+
else:
68+
_RequestMaker = Any
6569

6670

6771
@pytest.fixture

tests/test_proxy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
from aiohttp.helpers import TimerNoop
2020
from aiohttp.http import HttpVersion
2121

22-
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
22+
if sys.version_info >= (3, 11):
23+
from typing import Unpack
24+
25+
_RequestMaker = Callable[[str, URL, Unpack[ClientRequestArgs]], ClientRequest]
26+
else:
27+
_RequestMaker = Any
2328

2429

2530
@mock.patch("aiohttp.connector.ClientRequest")

0 commit comments

Comments
 (0)