You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Event unsubscribe will not actually stop the subscription, only the call_later handle will be cancelled, which has likely already executed and create the task.
@pytest.fixture(autouse=True)
def verify_cleanup(event_loop: asyncio.AbstractEventLoop):
"""Verify that the test has cleaned up resources correctly."""
threads_before = frozenset(threading.enumerate())
tasks_before = asyncio.all_tasks(event_loop)
yield
event_loop.run_until_complete(event_loop.shutdown_default_executor())
if len(INSTANCES) >= 2:
count = len(INSTANCES)
for inst in INSTANCES:
inst.stop()
pytest.exit(f"Detected non stopped instances ({count}), aborting test run")
threads = frozenset(threading.enumerate()) - threads_before
for thread in threads:
assert isinstance(thread, threading._DummyThread)
tasks = asyncio.all_tasks(event_loop) - tasks_before
> assert not tasks
E AssertionError: assert not {<Task pending name='Task-19' coro=<_GitHubEventsBaseNamespace.subscribe.<locals>._subscriber() running at /Users/joak...aiogithubapi/namespaces/events.py:132> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x116c73d60>()]>>}
Additional information
The text was updated successfully, but these errors were encountered:
Yup, meaning during tests these tended to leak over logs to next test. We now stop them manually. But would be better if it cleaned up fully when unloaded.
Its not causing any issues now though, so its up to you if you want to fix it or not.
Ill look into adding a new async method to stop all and only return when everything is done.
That should be added to __aexit__ anyway for those that uses async with ....
The problem
Event unsubscribe will not actually stop the subscription, only the call_later handle will be cancelled, which has likely already executed and create the task.
Noticed in: home-assistant/core#82475 and more specifically when adding: home-assistant/core@c7f0e11
aiogithubapi/aiogithubapi/namespaces/events.py
Line 137 in 178d28d
aiogithubapi/aiogithubapi/namespaces/events.py
Line 155 in 178d28d
Environment
Problem-relevant code
Traceback/Error logs
Additional information
The text was updated successfully, but these errors were encountered: