Skip to content

The agent that grows with you

test: patch HermesCLI on the cli module the slash worker reads

kshitijk4poor13b882c4b97d
diff --git a/tests/tui_gateway/test_slash_worker_provider.py b/tests/tui_gateway/test_slash_worker_provider.py
index 8b1409f3f62..6d06d925bfc 100644
--- a/tests/tui_gateway/test_slash_worker_provider.py
+++ b/tests/tui_gateway/test_slash_worker_provider.py
@@ -90,6 +90,7 @@ def test_slash_worker_child_forwards_provider_to_hermes_cli(monkeypatch):
"""The child's argparse accepts --provider and hands it to HermesCLI (mocked): the MoA
virtual provider must reach ``HermesCLI(provider=...)`` instead of config re-resolution."""
import sys as _sys
+ import types
import tui_gateway.slash_worker as sw
@@ -99,7 +100,8 @@ def test_slash_worker_child_forwards_provider_to_hermes_cli(monkeypatch):
def __init__(self, **kwargs):
built.update(kwargs)
- monkeypatch.setattr(sw, "HermesCLI", _FakeCLI)
+ # main() resolves HermesCLI from ``cli`` only after arming the watchdog, so patch it there.
+ monkeypatch.setitem(_sys.modules, "cli", types.SimpleNamespace(HermesCLI=_FakeCLI))
monkeypatch.setattr(sw, "_start_parent_death_watchdog", lambda *a: None)
monkeypatch.setattr(sw, "_prepare_slash_worker_runtime", lambda: None)
monkeypatch.setattr(sw.sys, "stdin", type("S", (), {"readline": lambda self: ""})())