Skip to content

The agent that grows with you

test: mock ownership probe in stop-guard test instead of raw env var

Tekniumaa9aaaa6cb31
diff --git a/tests/hermes_cli/test_gateway_restart_loop.py b/tests/hermes_cli/test_gateway_restart_loop.py
index b20bdb84f9d..b50d5f3b24c 100644
--- a/tests/hermes_cli/test_gateway_restart_loop.py
+++ b/tests/hermes_cli/test_gateway_restart_loop.py
@@ -200,7 +200,10 @@ class TestGatewaySelfTargetingGuard:
"""Verify hermes gateway stop/restart refuse when _HERMES_GATEWAY=1."""
def test_stop_refuses_inside_gateway(self, monkeypatch):
- monkeypatch.setenv("_HERMES_GATEWAY", "1")
+ from tools import process_registry
+ monkeypatch.setattr(
+ process_registry, "_is_supervised_gateway_process", lambda: True
+ )
from hermes_cli.gateway import gateway_command
args = Namespace(gateway_command="stop", all=False, system=False)
with pytest.raises(SystemExit) as exc_info: