Skip to content

The agent that grows with you

test: remove the stub cli module the import-order test leaves behind

kshitijk4poorbfc715268727
diff --git a/tests/tui_gateway/test_slash_worker_watchdog.py b/tests/tui_gateway/test_slash_worker_watchdog.py
index a996726ffc9..3f0aede0094 100644
--- a/tests/tui_gateway/test_slash_worker_watchdog.py
+++ b/tests/tui_gateway/test_slash_worker_watchdog.py
@@ -53,7 +53,9 @@ def test_main_arms_watchdog_then_imports_cli_before_runtime_prep(monkeypatch):
events.append(("cli-import",))
module.HermesCLI = FakeHermesCLI
- monkeypatch.delitem(sys.modules, "cli", raising=False)
+ # setitem first so teardown also removes the stub module the import below inserts.
+ monkeypatch.setitem(sys.modules, "cli", None)
+ monkeypatch.delitem(sys.modules, "cli")
monkeypatch.setattr(sys, "meta_path", [FakeCliFinder(), *sys.meta_path])
monkeypatch.setattr(
slash_worker,