Fix test_worker_waits_for_scheduler
Remove asyncio.wait_for from test.
It seems to be malfunctioning very rarely.
We replace it with a less sophisticated task + sleep + cancel.
Fixes
@@ -325,12 +325,15 @@ async def test_worker_port_range(s):
@gen_test(timeout=60)
async def test_worker_waits_for_scheduler():
w = Worker("127.0.0.1:8724")
- try:
- await asyncio.wait_for(w, 3)
- except TimeoutError:
- pass
- else:
- assert False
+
+ async def f():
+ await w
+
+ task = asyncio.create_task(f())
+ await asyncio.sleep(3)
+ assert not task.done()
+ task.cancel()
+
assert w.status not in (Status.closed, Status.running, Status.paused)
await w.close(timeout=0.1)
