mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-30 19:09:28 +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).
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""Tests for hermes_cli/tips.py — random tip display at session start."""
|
|
|
|
from hermes_cli.tips import TIPS, get_random_tip
|
|
|
|
|
|
class TestTipsCorpus:
|
|
"""Validate the tip corpus itself."""
|
|
|
|
def test_has_at_least_200_tips(self):
|
|
assert len(TIPS) >= 200, f"Expected 200+ tips, got {len(TIPS)}"
|
|
|
|
|
|
def test_all_tips_are_strings(self):
|
|
for i, tip in enumerate(TIPS):
|
|
assert isinstance(tip, str), f"Tip {i} is not a string: {type(tip)}"
|
|
|
|
|
|
class TestGetRandomTip:
|
|
"""Validate the get_random_tip() function."""
|
|
|
|
def test_returns_string(self):
|
|
tip = get_random_tip()
|
|
assert isinstance(tip, str)
|
|
assert len(tip) > 0
|
|
|
|
def test_returns_tip_from_corpus(self):
|
|
tip = get_random_tip()
|
|
assert tip in TIPS
|
|
|
|
def test_randomness(self):
|
|
"""Multiple calls should eventually return different tips."""
|
|
seen = set()
|
|
for _ in range(50):
|
|
seen.add(get_random_tip())
|
|
# With 200+ tips and 50 draws, we should see at least 10 unique
|
|
assert len(seen) >= 10, f"Only got {len(seen)} unique tips in 50 draws"
|
|
|
|
|
|
class TestTipIntegrationInCLI:
|
|
"""Test that the tip display code in cli.py works correctly."""
|
|
|
|
|
|
def test_tip_display_format(self):
|
|
"""Verify the Rich markup format doesn't break."""
|
|
tip = get_random_tip()
|
|
color = "#B8860B"
|
|
markup = f"[dim {color}]✦ Tip: {tip}[/]"
|
|
# Should not contain nested/broken Rich tags
|
|
assert markup.count("[/]") == 1
|
|
assert "[dim #B8860B]" in markup
|