Skip to content

Commit ec5eb34

Browse files
committed
add test to ensure warnings
1 parent 8751ff4 commit ec5eb34

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_connector.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,15 @@ async def test_cleanup_closed(
19211921
assert cleanup_closed_handle.cancel.called
19221922

19231923

1924+
async def test_cleanup_closed_is_noop_on_fixed_cpython() -> None:
1925+
"""Ensure that enable_cleanup_closed is a noop on fixed Python versions."""
1926+
with mock.patch("aiohttp.connector.NEEDS_CLEANUP_CLOSED", False), pytest.warns(
1927+
DeprecationWarning, match="cleanup_closed ignored"
1928+
):
1929+
conn = aiohttp.BaseConnector(enable_cleanup_closed=True)
1930+
assert conn._cleanup_closed_disabled is True
1931+
1932+
19241933
async def test_cleanup_closed_disabled(
19251934
loop: asyncio.AbstractEventLoop, mocker: MockerFixture
19261935
) -> None:

0 commit comments

Comments
 (0)