(self)
| 166 | |
| 167 | @pytest.mark.asyncio |
| 168 | async def test_worker_processes_task(self): |
| 169 | from core.tasks import TaskManager |
| 170 | tm = TaskManager() |
| 171 | results = [] |
| 172 | |
| 173 | async def work(): |
| 174 | results.append("done") |
| 175 | |
| 176 | await tm.add_task("t2", "test", work) |
| 177 | |
| 178 | # Run worker for a brief period |
| 179 | worker = asyncio.create_task(tm.worker()) |
| 180 | await asyncio.sleep(0.2) |
| 181 | worker.cancel() |
| 182 | |
| 183 | assert "done" in results |
| 184 | assert tm.active_tasks["t2"]["status"] == "done" |
| 185 | |
| 186 | @pytest.mark.asyncio |
| 187 | async def test_worker_handles_failure(self): |
nothing calls this directly
no test coverage detected