Skip to content

The agent that grows with you

fix(compat-fallout): repoint 4 test files to defining modules (update_cmd._detect_venv_python_processes, main_install_repair subprocess/_resolve_install_target_python, process_bootstrap.OpenAI, tools.mcp_tool gate import)

Tekniume6bfbf82faaa
diff --git a/tests/agent/test_turn_context.py b/tests/agent/test_turn_context.py
index 3a42fe76219..1d9c3406d98 100644
--- a/tests/agent/test_turn_context.py
+++ b/tests/agent/test_turn_context.py
@@ -446,6 +446,7 @@ def test_between_turns_refresh_adds_late_tool_when_servers_registered():
new_def = {"type": "function", "function": {"name": "mcp_x_tool", "description": "", "parameters": {}}}
import model_tools
+ import tools.mcp_tool # noqa: F401 — the prologue's import-cost gate requires it in sys.modules
with patch("tools.mcp_tool_discovery.has_registered_mcp_tools", return_value=True), \
patch.object(model_tools, "get_tool_definitions", return_value=[new_def]):
_build(agent)
diff --git a/tests/cron/test_stale_module_leaf_imports.py b/tests/cron/test_stale_module_leaf_imports.py
index 18847516554..e9083a6468e 100644
--- a/tests/cron/test_stale_module_leaf_imports.py
+++ b/tests/cron/test_stale_module_leaf_imports.py
@@ -27,10 +27,13 @@ def test_primary_client_ignores_stale_auxiliary_router(monkeypatch):
captured.update(kwargs)
return object()
+ from agent import process_bootstrap
+
+ monkeypatch.setattr(process_bootstrap, "OpenAI", fake_openai)
monkeypatch.setattr(
agent_runtime_helpers,
"_ra",
- lambda: SimpleNamespace(OpenAI=fake_openai, logger=logging.getLogger(__name__)),
+ lambda: SimpleNamespace(logger=logging.getLogger(__name__)),
)
agent = SimpleNamespace(
provider="openai-codex",
diff --git a/tests/hermes_cli/test_certifi_repair.py b/tests/hermes_cli/test_certifi_repair.py
index 442b9b2a8dd..90fc72d98d0 100644
--- a/tests/hermes_cli/test_certifi_repair.py
+++ b/tests/hermes_cli/test_certifi_repair.py
@@ -79,8 +79,6 @@ class TestUpdateProbeScriptChecksBundle:
def _run_probe_script(self, monkeypatch, tmp_path, bundle_path):
"""Extract the generated probe script and run it in-process against a
fake certifi that points at bundle_path."""
- from hermes_cli import main as main_mod
-
captured = {}
def fake_run(cmd, **kwargs):
@@ -93,9 +91,9 @@ class TestUpdateProbeScriptChecksBundle:
return _R()
- monkeypatch.setattr(main_mod.subprocess, "run", fake_run)
+ monkeypatch.setattr(main_install_repair.subprocess, "run", fake_run)
monkeypatch.setattr(
- main_mod, "_resolve_install_target_python", lambda *a, **k: sys.executable
+ main_install_repair, "_resolve_install_target_python", lambda *a, **k: sys.executable
)
main_install_repair._detect_broken_lazy_refresh_imports(["pip"])
script = captured["script"]
diff --git a/tests/hermes_cli/test_scan_venv_blockers.py b/tests/hermes_cli/test_scan_venv_blockers.py
index 2af75159c7a..a21f877b984 100644
--- a/tests/hermes_cli/test_scan_venv_blockers.py
+++ b/tests/hermes_cli/test_scan_venv_blockers.py
@@ -243,9 +243,9 @@ def _run_main_with_detector(monkeypatch, capsys, matches):
"""Run main() with the process detector patched to return *matches*."""
for name, mod in _psutil_fake().items():
monkeypatch.setitem(sys.modules, name, mod)
- import hermes_cli.main as cli_main
+ import hermes_cli.update_cmd as update_cmd
- monkeypatch.setattr(cli_main, "_detect_venv_python_processes", lambda: matches)
+ monkeypatch.setattr(update_cmd, "_detect_venv_python_processes", lambda: matches)
with pytest.raises(SystemExit) as excinfo:
main()
out = capsys.readouterr().out