mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +00:00
fix(cli): prefer curses over simple_term_menu in setup.py (#1487)
This commit is contained in:
parent
c9a9db318e
commit
5beb681c70
2 changed files with 107 additions and 115 deletions
29
tests/hermes_cli/test_setup_prompt_menus.py
Normal file
29
tests/hermes_cli/test_setup_prompt_menus.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from hermes_cli import setup as setup_mod
|
||||
|
||||
|
||||
def test_prompt_choice_uses_curses_helper(monkeypatch):
|
||||
monkeypatch.setattr(setup_mod, "_curses_prompt_choice", lambda question, choices, default=0: 1)
|
||||
|
||||
idx = setup_mod.prompt_choice("Pick one", ["a", "b", "c"], default=0)
|
||||
|
||||
assert idx == 1
|
||||
|
||||
|
||||
def test_prompt_choice_falls_back_to_numbered_input(monkeypatch):
|
||||
monkeypatch.setattr(setup_mod, "_curses_prompt_choice", lambda question, choices, default=0: -1)
|
||||
monkeypatch.setattr("builtins.input", lambda _prompt="": "2")
|
||||
|
||||
idx = setup_mod.prompt_choice("Pick one", ["a", "b", "c"], default=0)
|
||||
|
||||
assert idx == 1
|
||||
|
||||
|
||||
def test_prompt_checklist_uses_shared_curses_checklist(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.curses_ui.curses_checklist",
|
||||
lambda title, items, selected, cancel_returns=None: {0, 2},
|
||||
)
|
||||
|
||||
selected = setup_mod.prompt_checklist("Pick tools", ["one", "two", "three"], pre_selected=[1])
|
||||
|
||||
assert selected == [0, 2]
|
||||
Loading…
Add table
Add a link
Reference in a new issue