mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-24 16:54:43 +00:00
fix(computer_use): mock _cua_no_overlay in existing tests, fix platform-dependent assertions
- Add autouse fixture to TestMcpInvocationResolution to disable --no-overlay flag so existing tests assert baseline args - Make test_config_load_failure_fails_safe and test_missing_section_enables platform-aware (Linux auto-detect returns True, macOS/Windows False)
This commit is contained in:
parent
8ceada6e30
commit
f43ff5b4bb
2 changed files with 12 additions and 3 deletions
|
|
@ -47,15 +47,17 @@ class TestNoOverlayFlag:
|
|||
assert cua_backend._cua_no_overlay() is False
|
||||
|
||||
def test_config_load_failure_fails_safe(self):
|
||||
"""Unreadable config => default to overlay enabled."""
|
||||
"""Unreadable config => auto-detect (platform-dependent)."""
|
||||
with patch("hermes_cli.config.load_config",
|
||||
side_effect=RuntimeError("boom")):
|
||||
assert cua_backend._cua_no_overlay() is False
|
||||
expected = sys.platform == "linux"
|
||||
assert cua_backend._cua_no_overlay() is expected
|
||||
|
||||
def test_missing_section_enables(self):
|
||||
with patch("hermes_cli.config.load_config",
|
||||
return_value={"other": {}}):
|
||||
assert cua_backend._cua_no_overlay() is False
|
||||
expected = sys.platform == "linux"
|
||||
assert cua_backend._cua_no_overlay() is expected
|
||||
|
||||
|
||||
class TestMcpArgsOverlayFlag:
|
||||
|
|
|
|||
|
|
@ -2795,6 +2795,13 @@ class TestMcpInvocationResolution:
|
|||
fields, wrong types) falls back to the literal `["mcp"]` baseline.
|
||||
"""
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _no_overlay_off(self):
|
||||
"""Disable the --no-overlay flag so tests assert baseline args."""
|
||||
with patch("tools.computer_use.cua_backend._cua_no_overlay",
|
||||
return_value=False):
|
||||
yield
|
||||
|
||||
@staticmethod
|
||||
def _fake_run(stdout: str = "", returncode: int = 0, raises: Exception = None):
|
||||
"""Build a patched subprocess.run that yields the supplied result."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue