mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-24 05:41:40 +00:00
fix(update): use termux-all uv fallback path on Termux
This commit is contained in:
parent
3863d6d344
commit
6d5d467d39
3 changed files with 86 additions and 32 deletions
|
|
@ -311,7 +311,8 @@ def test_cmd_update_retries_optional_extras_individually_when_all_fails(monkeypa
|
|||
"""When .[all] fails, update should keep base deps and retry extras individually."""
|
||||
_setup_update_mocks(monkeypatch, tmp_path)
|
||||
monkeypatch.setattr("shutil.which", lambda name: "/usr/bin/uv" if name == "uv" else None)
|
||||
monkeypatch.setattr(hermes_main, "_load_installable_optional_extras", lambda: ["matrix", "mcp"])
|
||||
monkeypatch.setattr(hermes_main, "_is_termux_env", lambda env=None: False)
|
||||
monkeypatch.setattr(hermes_main, "_load_installable_optional_extras", lambda group="all": ["matrix", "mcp"])
|
||||
|
||||
recorded = []
|
||||
|
||||
|
|
@ -360,6 +361,7 @@ def test_cmd_update_succeeds_with_extras(monkeypatch, tmp_path):
|
|||
"""When .[all] succeeds, no fallback should be attempted."""
|
||||
_setup_update_mocks(monkeypatch, tmp_path)
|
||||
monkeypatch.setattr("shutil.which", lambda name: "/usr/bin/uv" if name == "uv" else None)
|
||||
monkeypatch.setattr(hermes_main, "_is_termux_env", lambda env=None: False)
|
||||
|
||||
recorded = []
|
||||
|
||||
|
|
@ -384,6 +386,36 @@ def test_cmd_update_succeeds_with_extras(monkeypatch, tmp_path):
|
|||
assert ".[all]" in install_cmds[0]
|
||||
|
||||
|
||||
def test_install_with_optional_fallback_honors_custom_group(monkeypatch):
|
||||
"""Termux update path should target .[termux-all] when requested."""
|
||||
calls = []
|
||||
monkeypatch.setattr(
|
||||
hermes_main,
|
||||
"_load_installable_optional_extras",
|
||||
lambda group="all": ["termux", "mcp"] if group == "termux-all" else [],
|
||||
)
|
||||
|
||||
def fake_run_with_heartbeat(cmd, **kwargs):
|
||||
calls.append(cmd)
|
||||
if cmd[-1] == ".[termux-all]":
|
||||
raise CalledProcessError(returncode=1, cmd=cmd)
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(hermes_main, "_run_install_with_heartbeat", fake_run_with_heartbeat)
|
||||
|
||||
hermes_main._install_python_dependencies_with_optional_fallback(
|
||||
["/usr/bin/uv", "pip"],
|
||||
group="termux-all",
|
||||
)
|
||||
|
||||
assert calls == [
|
||||
["/usr/bin/uv", "pip", "install", "-e", ".[termux-all]"],
|
||||
["/usr/bin/uv", "pip", "install", "-e", "."],
|
||||
["/usr/bin/uv", "pip", "install", "-e", ".[termux]"],
|
||||
["/usr/bin/uv", "pip", "install", "-e", ".[mcp]"],
|
||||
]
|
||||
|
||||
|
||||
def test_install_heartbeat_prints_when_dependency_install_is_silent(monkeypatch, capsys):
|
||||
"""Long quiet installs should emit periodic heartbeat lines."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue