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)

This commit is contained in:
Teknium
2026-09-03 15:54:46 -07:00
parent da96762ef8
commit e6bfbf82fa
4 changed files with 9 additions and 7 deletions
+1
View File
@@ -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)
+4 -1
View File
@@ -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",
+2 -4
View File
@@ -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"]
+2 -2
View File
@@ -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