(function: AsyncMock, delay: timedelta)
| 43 | |
| 44 | @pytest.mark.run_alone |
| 45 | async 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() |
nothing calls this directly
no test coverage detected