Skip to content

Fix test_worker_waits_for_scheduler #6155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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