Skip to content

The agent that grows with you

test(cli): neutralize the Windows supervisor scope in the no-gateways fleet-restart simulation too

teknium102b460a929da
diff --git a/tests/gateway/test_feishu.py b/tests/gateway/test_feishu.py
index 8612cd776d3..b64b68d616d 100644
--- a/tests/gateway/test_feishu.py
+++ b/tests/gateway/test_feishu.py
@@ -1709,11 +1709,12 @@ class TestDedupTTL(unittest.TestCase):
from gateway.config import PlatformConfig
from plugins.platforms.feishu.adapter import FeishuAdapter
- # Keep the per-test HERMES_HOME through the env wipe: the adapter resolves its
- # dedup store from get_hermes_home() at construction, and a cleared environment
- # falls back to the operator's real ~/.hermes, whose live ids leak into writes[-1].
- with patch.dict(os.environ, {"HERMES_HOME": os.environ["HERMES_HOME"]}, clear=True):
- adapter = FeishuAdapter(PlatformConfig())
+ # The class-level env wipe drops the per-test HERMES_HOME, so the adapter resolves
+ # its dedup store under the operator's real ~/.hermes and every id a live gateway
+ # persisted leaks into writes[-1]. Pin the store to a scratch path instead.
+ with tempfile.TemporaryDirectory() as scratch:
+ with patch("plugins.platforms.feishu.adapter.get_hermes_home", return_value=Path(scratch)):
+ adapter = FeishuAdapter(PlatformConfig())
writes = []
calls = [0]
diff --git a/tests/hermes_cli/test_update_fleet_restart_pending.py b/tests/hermes_cli/test_update_fleet_restart_pending.py
index 103fedb8477..e756b4edcf8 100644
--- a/tests/hermes_cli/test_update_fleet_restart_pending.py
+++ b/tests/hermes_cli/test_update_fleet_restart_pending.py
@@ -359,6 +359,8 @@ def test_run_pending_restart_true_when_no_gateways(monkeypatch, capsys):
monkeypatch.setattr(
update_cmd_fleet, "_restart_macos_launchd_gateways", lambda *a, **k: None
)
+ # And the Windows scope: an installed Windows gateway service would be restarted for real.
+ monkeypatch.setattr("hermes_cli.gateway_windows.is_installed", lambda: False)
assert update_cmd._run_pending_fleet_restart() is True
assert "Pending fleet restart completed" in capsys.readouterr().out