From 06031229e8d5efc312be4751909a1270dd444610 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 4 May 2026 01:40:39 -0700 Subject: [PATCH] fix(tests): tolerate ps ancestor-walk in find_gateway_pids fallback test (#19590) Follow-up to #19586 (@cixuuz salvage): _get_ancestor_pids walks ps -o ppid= up the process tree, which the pre-existing mock in test_find_gateway_pids_falls_back_to_pid_file_when_process_scan_fails didn't expect. Return empty stdout so the ancestor loop terminates cleanly and the original fallback assertion still passes. --- tests/hermes_cli/test_gateway.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/hermes_cli/test_gateway.py b/tests/hermes_cli/test_gateway.py index 0a44ac9532..6dfbd636f4 100644 --- a/tests/hermes_cli/test_gateway.py +++ b/tests/hermes_cli/test_gateway.py @@ -310,6 +310,10 @@ def test_find_gateway_pids_falls_back_to_pid_file_when_process_scan_fails(monkey def fake_run(cmd, **kwargs): if cmd[:4] == ["ps", "-A", "eww", "-o"]: return SimpleNamespace(returncode=1, stdout="", stderr="ps failed") + if cmd[:3] == ["ps", "-o", "ppid="]: + # _get_ancestor_pids() walks up the tree; return "no parent" so + # the loop terminates cleanly. + return SimpleNamespace(returncode=1, stdout="", stderr="") raise AssertionError(f"Unexpected command: {cmd}") monkeypatch.setattr(gateway.subprocess, "run", fake_run)