test: accept path= kwarg in global shutil.which stubs

_has_agent_browser()'s new managed-Node rung calls
shutil.which('agent-browser', path=...); tests that monkeypatch
shutil.which globally with 1-arg lambdas raised TypeError when their
code path reached the browser readiness probe (test_post_setup_gating,
test_setup_model_provider).
This commit is contained in:
Teknium 2026-07-28 23:36:26 -07:00
parent 2319dbb014
commit f98b223b58
2 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ class TestPostSetupGate:
from hermes_cli import tools_config
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
monkeypatch.setattr(tools_config.shutil, "which", lambda name: None)
monkeypatch.setattr(tools_config.shutil, "which", lambda name, path=None: None)
assert tools_config._toolset_needs_configuration_prompt(
"computer_use", {}
@ -36,7 +36,7 @@ class TestPostSetupGate:
monkeypatch.setattr(
tools_config.shutil,
"which",
lambda name: "/usr/local/bin/cua-driver" if name == "cua-driver" else None,
lambda name, path=None: "/usr/local/bin/cua-driver" if name == "cua-driver" else None,
)
assert tools_config._toolset_needs_configuration_prompt(

View file

@ -279,7 +279,7 @@ def test_setup_summary_marks_anthropic_auth_as_vision_available(tmp_path, monkey
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
_clear_provider_env(monkeypatch)
monkeypatch.setenv("ANTHROPIC_API_KEY", "sk-ant-api03-key")
monkeypatch.setattr("shutil.which", lambda _name: None)
monkeypatch.setattr("shutil.which", lambda _name, path=None: None)
monkeypatch.setattr("agent.auxiliary_client.get_available_vision_backends", lambda: ["anthropic"])
_print_setup_summary(load_config(), tmp_path)