The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(process): owned-child tests wait with tests.waiting.wait_until and run the Windows case natively
kshitijk4poorbcc1f11f1cda
diff --git a/tests/hermes_cli/test_process_identity_release_once_empty.py b/tests/hermes_cli/test_process_identity_release_once_empty.pyindex 6915c9e18b9..c381a6919c1 100644--- a/tests/hermes_cli/test_process_identity_release_once_empty.py+++ b/tests/hermes_cli/test_process_identity_release_once_empty.py@@ -3,16 +3,12 @@import osimport signalimport subprocess-import sysimport threadingimport pytestfrom hermes_cli import process_identity-pytestmark = pytest.mark.platforms("posix")--@pytest.fixturedef released(monkeypatch):calls: list = []@@ -25,6 +21,7 @@ def _leader(script: str) -> subprocess.Popen:start_new_session=True) # detached-spawn: ok — test stand-in, killed in finally[email protected]("posix")def test_an_empty_group_is_released_even_with_an_unreaped_leader(released):leader = _leader("exit 0")# Not wait()ed: the zombie leader keeps killpg(pgid, 0) succeeding until proc.poll() reaps it.@@ -32,6 +29,7 @@ def test_an_empty_group_is_released_even_with_an_unreaped_leader(released):assert released == [[leader.pid]][email protected]("posix")def test_a_group_with_a_live_member_stays_covered(released):leader = _leader("trap '' TERM; exec sleep 60")try:@@ -42,6 +40,7 @@ def test_a_group_with_a_live_member_stays_covered(released):leader.wait(timeout=10)[email protected]("posix")def test_it_waits_for_a_member_that_exits_late(released):leader = _leader("exec sleep 60")threading.Timer(0.3, lambda: os.killpg(leader.pid, signal.SIGKILL)).start() # windows-footgun: ok — posix-marked test@@ -54,7 +53,8 @@ def test_it_waits_for_a_member_that_exits_late(released):leader.wait(timeout=10)-def test_windows_never_releases(monkeypatch, released):- monkeypatch.setattr(process_identity.os, "name", "nt")- assert not process_identity.release_process_group_once_empty(sys.maxsize, timeout=0)[email protected]("windows")+def test_windows_never_releases(released):+ """Windows children die through the job object; there is no supervised group to release."""+ assert not process_identity.release_process_group_once_empty(os.getpid(), timeout=0)assert released == []diff --git a/tests/hermes_cli/test_process_identity_supervisor.py b/tests/hermes_cli/test_process_identity_supervisor.pyindex 9ac01a03188..0ef0713b21b 100644--- a/tests/hermes_cli/test_process_identity_supervisor.py+++ b/tests/hermes_cli/test_process_identity_supervisor.py@@ -19,6 +19,8 @@ from unittest.mock import AsyncMock, MagicMock, patchimport pytest+from tests.waiting import wait_until+from hermes_cli import process_identityfrom tools import mcp_toolfrom tools import mcp_tool_lifecycle as _mcp_lifecycle@@ -45,12 +47,11 @@ def _alive(pid: int) -> bool:def _wait_gone(pid: int, timeout: float = 15.0) -> bool:"""Wait for a process this test does NOT own to disappear."""- deadline = time.monotonic() + timeout- while time.monotonic() < deadline:- if not _alive(pid):- return True- time.sleep(0.05)- return False+ try:+ wait_until(lambda: not _alive(pid), timeout=timeout)+ except AssertionError:+ return False+ return Truedef _wait_exited(proc: subprocess.Popen, timeout: float = 15.0) -> bool: