hermes-agent/tests/plugins/test_raft_check_fn_silent.py
Teknium 6b81590c55
test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions
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).
2026-07-29 13:10:23 -07:00

33 lines
1.1 KiB
Python

"""Regression tests for the raft platform plugin's check_fn.
The raft platform adapter's ``check_raft_requirements()`` is registered as
the platform's ``check_fn``. This function is invoked on every
``load_gateway_config()`` call (dozens of times during normal gateway
operation). It must therefore be a *silent* predicate — returning True/False
without logging — otherwise every user without the ``raft`` CLI installed
gets their logs flooded with WARNING messages every few seconds.
See: https://github.com/NousResearch/hermes-agent/issues/49234
"""
import logging
from unittest.mock import patch
import pytest
@pytest.fixture
def raft_check():
"""Import check_raft_requirements fresh (adapter self-manages sys.path)."""
from plugins.platforms.raft.adapter import check_raft_requirements
return check_raft_requirements
def test_check_returns_false_when_raft_cli_missing(raft_check):
"""check_fn returns False when raft CLI is not in PATH."""
with patch("plugins.platforms.raft.adapter.shutil.which", return_value=None), \
patch("plugins.platforms.raft.adapter.AIOHTTP_AVAILABLE", True):
assert raft_check() is False