mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
Systematic prune per AGENTS.md test policy, one pass over every major test tree (gateway, hermes_cli, tools, agent, run_agent, plugins, cli, cron, tui_gateway, honcho/openviking, root-level): - DELETE: source-reading tests (read_text/getsource on prod files), change-detector tests (exact catalog counts, model-name snapshots, config version literals), mock-echo tests (assert a mock returns what it was told), assertion-free/trivial tests, near-duplicate parametrizations (boundaries + one representative kept), async/sync twin duplicates, cosmetic within-file variations. - KEEP (mandatory): security/redaction/approval guards, message-role alternation invariants, prompt-caching/deterministic-call-id invariants, issue-number regression tests (deduped), E2E tests. - 6 test files deleted outright (script-style/no-assert or fully redundant); conftest.py, fakes/, fixtures/ untouched. - tests/acp/conftest.py added: autouse fixture stubs the live models.dev/GitHub/Copilot/Anthropic inventory fetches that ACP server tests performed on every session create — test_server.py 147s → 3.4s, and the tests are now genuinely hermetic. - Sleep-based slowness shrunk where safe (codex_ttfb_watchdog, compression_concurrent_fork, etc.); no wall-clock assertion tightened. Verification: full hermetic suite via scripts/run_tests.sh — 2439 files, 31,130 tests passed, 0 failed, 0 flaky retries, 315s wall (baseline: 583s wall, 13,564s subprocess CPU).
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
"""Tests for the prompt_toolkit /model picker scroll viewport.
|
|
|
|
Regression for: when a provider exposes many models (e.g. Ollama Cloud's
|
|
36+), the picker rendered every choice into a Window with no max height,
|
|
clipping the bottom border and any items past the terminal's last row.
|
|
The viewport helper now caps visible items and slides the offset to keep
|
|
the cursor on screen.
|
|
"""
|
|
from cli import HermesCLI
|
|
|
|
|
|
_compute = HermesCLI._compute_model_picker_viewport
|
|
|
|
|
|
class TestPickerViewport:
|
|
def test_short_list_no_scroll(self):
|
|
offset, visible = _compute(selected=0, scroll_offset=0, n=5, term_rows=30)
|
|
assert offset == 0
|
|
assert visible == 5
|
|
|
|
|
|
def test_offset_recovers_after_stage_switch(self):
|
|
# When the user backs out of the model stage and re-enters with
|
|
# selected=0, a stale offset from the previous stage must collapse.
|
|
offset, visible = _compute(selected=0, scroll_offset=25, n=36, term_rows=30)
|
|
assert offset == 0
|
|
assert 0 in range(offset, offset + visible)
|
|
|
|
def test_full_navigation_keeps_cursor_visible(self):
|
|
offset = 0
|
|
for cursor in list(range(36)) + list(range(35, -1, -1)):
|
|
offset, visible = _compute(cursor, offset, n=36, term_rows=30)
|
|
assert cursor in range(offset, offset + visible), (
|
|
f"cursor={cursor} out of view: offset={offset} visible={visible}"
|
|
)
|