Skip to content
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
9 changes: 5 additions & 4 deletions tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ def gen_f():
# do some work async
work = [1, 2, 3, 4]
m.test_async_callback(gen_f(), work)
# wait until work is done
from time import sleep

sleep(0.5)
# Wait for all detached worker threads to finish.
deadline = time.monotonic() + 5.0
while len(res) < len(work) and time.monotonic() < deadline:
time.sleep(0.01)
assert len(res) == len(work), f"Timed out waiting for callbacks: res={res!r}"
assert sum(res) == sum(x + 3 for x in work)


Expand Down