mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-17 04:12:24 +02:00
test(runtime): clean Wave 3 validation warnings
This commit is contained in:
@@ -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 cleaned == [(Path("/tmp/test-socket-dir"), "ody-test1234")]
|
||||||
assert browser._REGISTRY == {}
|
assert browser._REGISTRY == {}
|
||||||
record.invalidate.assert_called_once()
|
record.invalidate.assert_called_once()
|
||||||
|
|
||||||
|
|||||||
@@ -107,11 +107,26 @@ def _drive_scheduler(monkeypatch, pre_start_setup=None):
|
|||||||
monkeypatch.setattr(sch, "_note_pings_loop", _never)
|
monkeypatch.setattr(sch, "_note_pings_loop", _never)
|
||||||
|
|
||||||
dispatched = []
|
dispatched = []
|
||||||
|
|
||||||
def _fake_create_task(coro):
|
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:
|
class _T:
|
||||||
def cancel(self): pass
|
def cancel(self):
|
||||||
|
pass
|
||||||
|
|
||||||
return _T()
|
return _T()
|
||||||
|
|
||||||
monkeypatch.setattr("src.task_scheduler.asyncio.create_task", _fake_create_task)
|
monkeypatch.setattr("src.task_scheduler.asyncio.create_task", _fake_create_task)
|
||||||
|
|
||||||
async def _drive():
|
async def _drive():
|
||||||
@@ -120,11 +135,7 @@ def _drive_scheduler(monkeypatch, pre_start_setup=None):
|
|||||||
await sch._check_due_tasks()
|
await sch._check_due_tasks()
|
||||||
return dispatched
|
return dispatched
|
||||||
|
|
||||||
all_dispatched = asyncio.run(_drive())
|
real_dispatches = 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"]
|
|
||||||
return cd, ScheduledTask, TaskRun, real_dispatches
|
return cd, ScheduledTask, TaskRun, real_dispatches
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user