Skip to content

Commit

Permalink
test(supervisors): improve test_multiprocess reliability
Browse files Browse the repository at this point in the history
- Replace fixed sleep with retry mechanism for process status checks- Enhance test stability by allowing for variable process startup times
  • Loading branch information
vvanglro committed Nov 21, 2024
1 parent b8f2769 commit 0b1b372
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/supervisors/test_multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,15 @@ def test_multiprocess_health_check() -> None:
process.join()
try:
assert not process.is_alive(0.5)
time.sleep(1.5) # release gil, ensure process restart complete.
for p in supervisor.processes:
assert p.is_alive()
while retry := 3:
try:
for p in supervisor.processes:
assert p.is_alive()
except AssertionError:
retry -= 1
time.sleep(0.5)
else:
break
finally:
supervisor.signal_queue.append(signal.SIGINT)
supervisor.join_all()
Expand Down

0 comments on commit 0b1b372

Please sign in to comment.