The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): wait for the exited PID with wait_until, not a sleep loop
Teknium1d958d761e2f
diff --git a/tests/gateway/test_status_strict_identity_live.py b/tests/gateway/test_status_strict_identity_live.pyindex 7af0b1687e8..f047fad6e7d 100644--- a/tests/gateway/test_status_strict_identity_live.py+++ b/tests/gateway/test_status_strict_identity_live.py@@ -20,7 +20,6 @@ import queueimport subprocessimport sysimport threading-import timefrom contextlib import suppressfrom pathlib import Path@@ -28,6 +27,7 @@ import psutilimport pytestfrom gateway import status+from tests.waiting import wait_untilPROJECT_ROOT = Path(__file__).resolve().parents[2]@@ -104,11 +104,7 @@ def _exited_pid() -> int:child = subprocess.run([sys.executable, "-c", "import os; print(os.getpid())"],capture_output=True, text=True, timeout=60, check=False)pid = int(child.stdout.strip())- for _ in range(100):- if not psutil.pid_exists(pid):- return pid- time.sleep(0.05)- pytest.fail(f"child {pid} is still alive after exit")+ wait_until(lambda: not psutil.pid_exists(pid), what=f"exited child {pid} to leave the process table")return pid