1- from collections .abc import Awaitable , Iterator
1+ from collections .abc import AsyncIterator , Awaitable
22from typing import (
33 Any ,
44 Dict ,
2020
2121
2222class AiohttpClient (Protocol ):
23+ # TODO(PY311): Use Unpack to specify ClientSession kwargs.
2324 @overload
24- async def __call__ (
25+ async def __call__ ( # type: ignore[misc]
2526 self ,
2627 __param : Application ,
2728 * ,
@@ -30,7 +31,7 @@ async def __call__(
3031 ) -> TestClient [Request , Application ]: ...
3132
3233 @overload
33- async def __call__ (
34+ async def __call__ ( # type: ignore[misc]
3435 self ,
3536 __param : BaseTestServer , # TODO(aiohttp4): BaseTestServer[_Request]
3637 * ,
@@ -64,7 +65,7 @@ def __call__(
6465
6566
6667@pytest .hookimpl (tryfirst = True )
67- def pytest_configure (config ) -> None :
68+ def pytest_configure (config : pytest . Config ) -> None :
6869 val = config .getoption ("asyncio_mode" )
6970 if val is None :
7071 val = config .getini ("asyncio_mode" )
@@ -74,7 +75,7 @@ def pytest_configure(config) -> None:
7475
7576
7677@pytest_asyncio .fixture
77- async def aiohttp_server () -> Iterator [AiohttpServer ]:
78+ async def aiohttp_server () -> AsyncIterator [AiohttpServer ]:
7879 """Factory to create a TestServer instance, given an app.
7980
8081 aiohttp_server(app, **kwargs)
@@ -100,7 +101,7 @@ async def go(
100101
101102
102103@pytest_asyncio .fixture
103- async def aiohttp_raw_server () -> Iterator [AiohttpRawServer ]:
104+ async def aiohttp_raw_server () -> AsyncIterator [AiohttpRawServer ]:
104105 """Factory to create a RawTestServer instance, given a web handler.
105106
106107 aiohttp_raw_server(handler, **kwargs)
@@ -124,8 +125,8 @@ async def go(
124125 await servers .pop ().close ()
125126
126127
127- @pytest_asyncio .fixture
128- def aiohttp_client_cls () -> Type [TestClient [Any , Any ]]:
128+ @pytest .fixture
129+ def aiohttp_client_cls () -> Type [TestClient [Any , Any ]]: # type: ignore[misc]
129130 """
130131 Client class to use in ``aiohttp_client`` factory.
131132
@@ -152,9 +153,9 @@ def test_login(aiohttp_client):
152153
153154
154155@pytest_asyncio .fixture
155- async def aiohttp_client (
156+ async def aiohttp_client ( # type: ignore[misc]
156157 aiohttp_client_cls : Type [TestClient [Any , Any ]],
157- ) -> Iterator [AiohttpClient ]:
158+ ) -> AsyncIterator [AiohttpClient ]:
158159 """Factory to create a TestClient instance.
159160
160161 aiohttp_client(app, **kwargs)
@@ -164,15 +165,15 @@ async def aiohttp_client(
164165 clients = []
165166
166167 @overload
167- async def go (
168+ async def go ( # type: ignore[misc]
168169 __param : Application ,
169170 * ,
170171 server_kwargs : Optional [Dict [str , Any ]] = None ,
171172 ** kwargs : Any ,
172173 ) -> TestClient [Request , Application ]: ...
173174
174175 @overload
175- async def go (
176+ async def go ( # type: ignore[misc]
176177 __param : BaseTestServer , # TODO(aiohttp4): BaseTestServer[_Request]
177178 * ,
178179 server_kwargs : Optional [Dict [str , Any ]] = None ,
@@ -187,6 +188,7 @@ async def go(
187188 server_kwargs : Optional [Dict [str , Any ]] = None ,
188189 ** kwargs : Any ,
189190 ) -> TestClient [Any , Any ]:
191+ # TODO(PY311): Use Unpack to specify ClientSession kwargs and server_kwargs.
190192 if isinstance (__param , Application ):
191193 server_kwargs = server_kwargs or {}
192194 server = TestServer (__param , ** server_kwargs )
0 commit comments