Skip to content

Commit

Permalink
add test to ensure warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Nov 9, 2024
1 parent 8751ff4 commit ec5eb34
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,15 @@ async def test_cleanup_closed(
assert cleanup_closed_handle.cancel.called


async def test_cleanup_closed_is_noop_on_fixed_cpython() -> None:
"""Ensure that enable_cleanup_closed is a noop on fixed Python versions."""
with mock.patch("aiohttp.connector.NEEDS_CLEANUP_CLOSED", False), pytest.warns(
DeprecationWarning, match="cleanup_closed ignored"
):
conn = aiohttp.BaseConnector(enable_cleanup_closed=True)
assert conn._cleanup_closed_disabled is True


async def test_cleanup_closed_disabled(
loop: asyncio.AbstractEventLoop, mocker: MockerFixture
) -> None:
Expand Down

0 comments on commit ec5eb34

Please sign in to comment.