diff --git a/aiohttp/pytest_plugin.py b/aiohttp/pytest_plugin.py index d15876cba66..eeb33fafaf9 100644 --- a/aiohttp/pytest_plugin.py +++ b/aiohttp/pytest_plugin.py @@ -361,7 +361,7 @@ async def finalize() -> None: @pytest.fixture -def aiohttp_client_cls() -> Type[TestClient[Any, Any]]: # type: ignore[misc] +def aiohttp_client_cls() -> Type[TestClient[Any, Any]]: """ Client class to use in ``aiohttp_client`` factory. @@ -388,7 +388,7 @@ def test_login(aiohttp_client): @pytest.fixture -def aiohttp_client( # type: ignore[misc] +def aiohttp_client( loop: asyncio.AbstractEventLoop, aiohttp_client_cls: Type[TestClient[Any, Any]] ) -> Iterator[AiohttpClient]: """Factory to create a TestClient instance. diff --git a/requirements/constraints.txt b/requirements/constraints.txt index b8287720c9c..641af5da395 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -167,6 +167,7 @@ pyenchant==3.2.2 # via sphinxcontrib-spelling pygments==2.19.1 # via + # pytest # rich # sphinx pyjwt==2.8.0 @@ -177,7 +178,7 @@ pyproject-hooks==1.2.0 # via # build # pip-tools -pytest==8.1.1 +pytest==8.4.1 # via # -r requirements/lint.in # -r requirements/test.in @@ -299,6 +300,10 @@ zlib-ng==0.5.1 # via # -r requirements/lint.in # -r requirements/test.in +zstandard==0.23.0 ; implementation_name == "cpython" + # via + # -r requirements/lint.in + # -r requirements/runtime-deps.in # The following packages are considered to be unsafe in a requirements file: pip==25.1.1 diff --git a/requirements/dev.txt b/requirements/dev.txt index aafecf2f30c..d4f448d3e63 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -162,6 +162,7 @@ pydantic-core==2.33.2 # via pydantic pygments==2.19.1 # via + # pytest # rich # sphinx pyjwt==2.8.0 @@ -172,7 +173,7 @@ pyproject-hooks==1.2.0 # via # build # pip-tools -pytest==8.1.1 +pytest==8.4.1 # via # -r requirements/lint.in # -r requirements/test.in @@ -290,6 +291,10 @@ zlib-ng==0.5.1 # via # -r requirements/lint.in # -r requirements/test.in +zstandard==0.23.0 ; platform_python_implementation == "CPython" and python_version < "3.14" + # via + # -r requirements/lint.in + # -r requirements/runtime-deps.in # The following packages are considered to be unsafe in a requirements file: pip==25.1.1 diff --git a/requirements/lint.txt b/requirements/lint.txt index 02a73831cb7..f6dcbba3804 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -8,6 +8,8 @@ aiodns==3.5.0 # via -r requirements/lint.in annotated-types==0.7.0 # via pydantic +async-timeout==5.0.1 + # via valkey blockbuster==1.5.24 # via -r requirements/lint.in cffi==1.17.1 @@ -23,6 +25,8 @@ cryptography==45.0.4 # via trustme distlib==0.3.9 # via virtualenv +exceptiongroup==1.3.0 + # via pytest filelock==3.18.0 # via virtualenv forbiddenfruit==0.1.4 @@ -68,8 +72,10 @@ pydantic==2.11.7 pydantic-core==2.33.2 # via pydantic pygments==2.19.1 - # via rich -pytest==8.1.1 + # via + # pytest + # rich +pytest==8.4.1 # via # -r requirements/lint.in # pytest-codspeed @@ -90,14 +96,21 @@ six==1.17.0 # via python-dateutil slotscheck==0.19.1 # via -r requirements/lint.in +tomli==2.2.1 + # via + # mypy + # pytest + # slotscheck trustme==1.2.1 # via -r requirements/lint.in typing-extensions==4.14.0 # via + # exceptiongroup # mypy # pydantic # pydantic-core # python-on-whales + # rich # typing-inspection typing-inspection==0.4.1 # via pydantic diff --git a/requirements/test.txt b/requirements/test.txt index 861fe380148..c94e5f91ea5 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -92,8 +92,10 @@ pydantic==2.11.7 pydantic-core==2.33.2 # via pydantic pygments==2.19.1 - # via rich -pytest==8.1.1 + # via + # pytest + # rich +pytest==8.4.1 # via # -r requirements/test.in # pytest-codspeed @@ -145,3 +147,5 @@ yarl==1.20.1 # via -r requirements/runtime-deps.in zlib-ng==0.5.1 # via -r requirements/test.in +zstandard==0.23.0 ; platform_python_implementation == "CPython" and python_version < "3.14" + # via -r requirements/runtime-deps.in diff --git a/tests/test_client_connection.py b/tests/test_client_connection.py index e36c7aa9595..9c93ba0d8f2 100644 --- a/tests/test_client_connection.py +++ b/tests/test_client_connection.py @@ -16,7 +16,7 @@ def key() -> object: @pytest.fixture -def loop() -> Any: # type: ignore[misc] +def loop() -> Any: return mock.create_autospec(asyncio.AbstractEventLoop, spec_set=True, instance=True) diff --git a/tests/test_client_session.py b/tests/test_client_session.py index 80779886dca..1b8c3878828 100644 --- a/tests/test_client_session.py +++ b/tests/test_client_session.py @@ -65,7 +65,7 @@ async def make_conn() -> BaseConnector: @pytest.fixture -def create_session( # type: ignore[misc] +def create_session( loop: asyncio.AbstractEventLoop, ) -> Iterator[Callable[..., Awaitable[ClientSession]]]: session = None @@ -81,7 +81,7 @@ async def maker(*args: Any, **kwargs: Any) -> ClientSession: @pytest.fixture -def session( # type: ignore[misc] +def session( create_session: Callable[..., Awaitable[ClientSession]], loop: asyncio.AbstractEventLoop, ) -> ClientSession: diff --git a/tests/test_connector.py b/tests/test_connector.py index 3e9f60a59cf..1a739674ce3 100644 --- a/tests/test_connector.py +++ b/tests/test_connector.py @@ -55,25 +55,25 @@ @pytest.fixture -def key() -> ConnectionKey: # type: ignore[misc] +def key() -> ConnectionKey: # Connection key return ConnectionKey("localhost", 80, False, True, None, None, None) @pytest.fixture -def key2() -> ConnectionKey: # type: ignore[misc] +def key2() -> ConnectionKey: # Connection key return ConnectionKey("localhost", 80, False, True, None, None, None) @pytest.fixture -def other_host_key2() -> ConnectionKey: # type: ignore[misc] +def other_host_key2() -> ConnectionKey: # Connection key return ConnectionKey("otherhost", 80, False, True, None, None, None) @pytest.fixture -def ssl_key() -> ConnectionKey: # type: ignore[misc] +def ssl_key() -> ConnectionKey: # Connection key return ConnectionKey("localhost", 80, True, True, None, None, None) diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py index fd7a52f0b88..4a1e196f8eb 100644 --- a/tests/test_http_parser.py +++ b/tests/test_http_parser.py @@ -54,7 +54,7 @@ @pytest.fixture -def protocol() -> Any: # type: ignore[misc] +def protocol() -> Any: return mock.create_autospec(BaseProtocol, spec_set=True, instance=True) diff --git a/tests/test_http_writer.py b/tests/test_http_writer.py index 6c83e08cc91..1d6cf439e4e 100644 --- a/tests/test_http_writer.py +++ b/tests/test_http_writer.py @@ -38,7 +38,7 @@ def buf() -> bytearray: @pytest.fixture -def transport(buf: bytearray) -> Any: # type: ignore[misc] +def transport(buf: bytearray) -> Any: transport = mock.create_autospec(asyncio.Transport, spec_set=True, instance=True) def write(chunk: bytes) -> None: @@ -55,7 +55,7 @@ def writelines(chunks: Iterable[bytes]) -> None: @pytest.fixture -def protocol(loop: asyncio.AbstractEventLoop, transport: asyncio.Transport) -> Any: # type: ignore[misc] +def protocol(loop: asyncio.AbstractEventLoop, transport: asyncio.Transport) -> Any: return mock.create_autospec( BaseProtocol, spec_set=True, instance=True, transport=transport ) diff --git a/tests/test_test_utils.py b/tests/test_test_utils.py index 20f4f2540ec..026be2f906c 100644 --- a/tests/test_test_utils.py +++ b/tests/test_test_utils.py @@ -300,6 +300,7 @@ async def test_server_make_url_yarl_compatibility( make_url(URL("http://foo.com")) +@pytest.mark.xfail(reason="https://github.com/pytest-dev/pytest/issues/13546") def test_testcase_no_app( testdir: pytest.Testdir, loop: asyncio.AbstractEventLoop ) -> None: