Skip to content

Commit 7e9ce2c

Browse files
authored
Poll for PID changes in test_multiprocess_sighup instead of fixed sleep (#2815)
The 1-second sleep wasn't always enough for the supervisor to pick up the signal and complete `restart_all()`, causing flaky failures on macOS 3.14.
1 parent 99f0d87 commit 7e9ce2c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/supervisors/test_multiprocess.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ def test_multiprocess_sighup() -> None:
129129
time.sleep(1)
130130
pids = [p.pid for p in supervisor.processes]
131131
supervisor.signal_queue.append(signal.SIGHUP)
132-
time.sleep(1)
132+
# Poll instead of a fixed sleep — the supervisor loop runs on a 0.5s interval and `restart_all()` terminates/joins
133+
# each worker sequentially, so the total time is non-deterministic.
134+
deadline = time.monotonic() + 10
135+
while time.monotonic() < deadline:
136+
if [p.pid for p in supervisor.processes] != pids:
137+
break
138+
time.sleep(0.1)
133139
assert pids != [p.pid for p in supervisor.processes]
134140
supervisor.signal_queue.append(signal.SIGINT)
135141
supervisor.join_all()

0 commit comments

Comments
 (0)