Reduce log level for linger task/timer (#83703)

We don't need to warn that loudly for these issues.
This commit is contained in:
Joakim Plate 2022-12-10 12:12:56 +01:00 committed by GitHub
parent d2fc3a22e2
commit c196fefe31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -14,7 +14,6 @@ import ssl
import threading
from typing import Any
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import warnings
from aiohttp import client
from aiohttp.pytest_plugin import AiohttpClient
@ -212,14 +211,14 @@ def verify_cleanup(event_loop: asyncio.AbstractEventLoop):
# before moving on to the next test.
tasks = asyncio.all_tasks(event_loop) - tasks_before
for task in tasks:
warnings.warn(f"Linger task after test {task}")
_LOGGER.warning("Linger task after test %r", task)
task.cancel()
if tasks:
event_loop.run_until_complete(asyncio.wait(tasks))
for handle in event_loop._scheduled: # pylint: disable=protected-access
if not handle.cancelled():
warnings.warn(f"Lingering timer after test {handle}")
_LOGGER.warning("Lingering timer after test %r", handle)
handle.cancel()
# Make sure garbage collect run in same test as allocation