Skip to content

Commit

Permalink
Fix test_worker_waits_for_scheduler (#6155)
Browse files Browse the repository at this point in the history
Remove asyncio.wait_for from test.
It seems to be malfunctioning very rarely.
We replace it with a less sophisticated task + sleep + cancel.

Fixes #6153
  • Loading branch information
mrocklin authored Apr 19, 2022
1 parent fc5b460 commit 15ca62e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions distributed/tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 15ca62e

Please sign in to comment.