MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_execution

Function test_execution

tests/unit/_utils/test_recurring_task.py:45–55  ·  view source on GitHub ↗
(function: AsyncMock, delay: timedelta)

Source from the content-addressed store, hash-verified

43
44@pytest.mark.run_alone
45async def test_execution(function: AsyncMock, delay: timedelta) -> None:
46 task = RecurringTask(function, delay)
47
48 task.start()
49 await asyncio.sleep(0.2) # Wait enough for the task to execute a few times
50 await task.stop()
51
52 assert isinstance(task.func, AsyncMock) # To let type checker know that the function is a mock
53 assert task.func.call_count >= 3
54
55 await task.stop()

Callers

nothing calls this directly

Calls 3

startMethod · 0.95
stopMethod · 0.95
RecurringTaskClass · 0.90

Tested by

no test coverage detected