MCPcopy Create free account
hub / github.com/debpalash/VoiceStudio / test_worker_processes_task

Method test_worker_processes_task

tests/test_api.py:168–184  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 4

add_taskMethod · 0.95
workerMethod · 0.95
TaskManagerClass · 0.90
cancelMethod · 0.45

Tested by

no test coverage detected