test(runtime): clean Wave 3 validation warnings

This commit is contained in:
Alexandre Teixeira
2026-10-02 18:57:53 +01:00
parent 7afa6e524d
commit b7182fff54
2 changed files with 18 additions and 8 deletions
-1
View File
@@ -773,4 +773,3 @@ async def test_shutdown_cleans_up_invalidated_registered_browser_session(monkeyp
assert cleaned == [(Path("/tmp/test-socket-dir"), "ody-test1234")]
assert browser._REGISTRY == {}
record.invalidate.assert_called_once()
+18 -7
View File
@@ -107,11 +107,26 @@ def _drive_scheduler(monkeypatch, pre_start_setup=None):
monkeypatch.setattr(sch, "_note_pings_loop", _never)
dispatched = []
def _fake_create_task(coro):
dispatched.append(coro)
name = getattr(getattr(coro, "cr_code", None), "co_name", None)
# start() schedules the long-lived scheduler loops. This test replaces
# asyncio.create_task intentionally, so intercepted coroutine objects
# must be closed explicitly instead of being left unawaited.
if name != "_never":
dispatched.append(coro)
close = getattr(coro, "close", None)
if callable(close):
close()
class _T:
def cancel(self): pass
def cancel(self):
pass
return _T()
monkeypatch.setattr("src.task_scheduler.asyncio.create_task", _fake_create_task)
async def _drive():
@@ -120,11 +135,7 @@ def _drive_scheduler(monkeypatch, pre_start_setup=None):
await sch._check_due_tasks()
return dispatched
all_dispatched = asyncio.run(_drive())
# start() also fires the long-lived _loop and _note_pings_loop as tasks
# (stubbed to _never here); filter those out so the test only counts
# real per-poll task dispatches.
real_dispatches = [c for c in all_dispatched if c.__name__ != "_never"]
real_dispatches = asyncio.run(_drive())
return cd, ScheduledTask, TaskRun, real_dispatches