The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: wait for a spawned gateway stub's argv before matching it
Tekniumc15e04df399e
diff --git a/tests/hermes_cli/test_update_pause_unmapped_home_proof.py b/tests/hermes_cli/test_update_pause_unmapped_home_proof.pyindex 735049bcc5a..1402c2eecc7 100644--- a/tests/hermes_cli/test_update_pause_unmapped_home_proof.py+++ b/tests/hermes_cli/test_update_pause_unmapped_home_proof.py@@ -24,6 +24,7 @@ from gateway.status import get_process_start_timefrom hermes_cli import dashboard_procs, gateway, process_identity, update_cmd_windowsfrom hermes_cli import update_pause_record as pause_recordfrom hermes_cli.update_cmd_windows import _pause_windows_gateways_for_update, _unmapped_ready_filter+from tests.waiting import wait_until@pytest.fixture@@ -41,6 +42,9 @@ def homes_and_spawn(tmp_path):def spawn(home) -> subprocess.Popen:proc = subprocess.Popen(argv, env={**os.environ, "HERMES_HOME": str(home)})procs.append(proc)+ # Popen returns once exec has begun, before the kernel publishes the new image's argv and+ # environment: /proc/<pid>/cmdline reads empty for that instant. A gateway is running.+ wait_until(psutil.Process(proc.pid).cmdline, interval=0.001, what="the spawned gateway's argv")return procyield home_a, home_b, spawndiff --git a/tests/hermes_cli/test_update_pause_unmapped_identity.py b/tests/hermes_cli/test_update_pause_unmapped_identity.pyindex 43627b97faa..e874388d3c0 100644--- a/tests/hermes_cli/test_update_pause_unmapped_identity.py+++ b/tests/hermes_cli/test_update_pause_unmapped_identity.py@@ -17,10 +17,12 @@ import subprocessimport sysimport time+import psutilimport pytestfrom gateway.status import get_process_start_timefrom hermes_cli.update_cmd_windows import _unmapped_ready_filter+from tests.waiting import wait_until@pytest.fixture@@ -33,7 +35,10 @@ def spawn(tmp_path):def _spawn(home) -> subprocess.Popen:proc = subprocess.Popen(argv, env={**os.environ, "HERMES_HOME": str(home)})- procs.append(proc) # Popen returns after exec: the gateway argv and environment are in place+ procs.append(proc)+ # Popen returns once exec has begun, before the kernel publishes the new image's argv and+ # environment: /proc/<pid>/cmdline reads empty for that instant. A gateway is running.+ wait_until(psutil.Process(proc.pid).cmdline, interval=0.001, what="the spawned gateway's argv")return procyield _spawn, argv