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
10 changes: 9 additions & 1 deletion tests/python/core/cloudxr/test_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ def test_recognises_a_service_under_any_shipped_module_name(self, tmp_path, modu
)
try:
background.pid_path(str(tmp_path)).write_text(f"{proc.pid}\n")
assert background.read_pid(str(tmp_path)) == proc.pid
# A freshly spawned pid's /proc/<pid>/cmdline isn't guaranteed to be
# populated the instant Popen() returns, especially on a loaded CI
# runner - poll briefly instead of asserting on the very first read.
deadline = time.monotonic() + 2.0
pid = background.read_pid(str(tmp_path))
while pid is None and time.monotonic() < deadline:
time.sleep(0.05)
pid = background.read_pid(str(tmp_path))
assert pid == proc.pid
finally:
proc.kill()
proc.wait()
Expand Down
Loading