mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
test: remove 169 change-detector tests across 21 files (#11472)
First pass of test-suite reduction to address flaky CI and bloat. Removed tests that fall into these change-detector patterns: 1. Source-grep tests (tests/gateway/test_feishu.py, test_email.py): tests that call inspect.getsource() on production modules and grep for string literals. Break on any refactor/rename even when behavior is correct. 2. Platform enum tautologies (every gateway/test_X.py): assertions like `Platform.X.value == 'x'` duplicated across ~9 adapter test files. 3. Toolset/PLATFORM_HINTS/setup-wizard registry-presence checks: tests that only verify a key exists in a dict. Data-layout tests, not behavior. 4. Argparse wiring tests (test_argparse_flag_propagation, test_subparser_routing _fallback): tests that do parser.parse_args([...]) then assert args.field. Tests Python's argparse, not our code. 5. Pure dispatch tests (test_plugins_cmd.TestPluginsCommandDispatch): patch cmd_X, call plugins_command with matching action, assert mock called. Tests the if/elif chain, not behavior. 6. Kwarg-to-mock verification (test_auxiliary_client ~45 tests, test_web_tools_config, test_gemini_cloudcode, test_retaindb_plugin): tests that mock the external API client, call our function, and assert exact kwargs. Break on refactor even when behavior is preserved. 7. Schedule-internal "function-was-called" tests (acp/test_server scheduling tests): tests that patch own helper method, then assert it was called. Kept behavioral tests throughout: error paths (pytest.raises), security tests (path traversal, SSRF, redaction), message alternation invariants, provider API format conversion, streaming logic, memory contract, real config load/merge tests. Net reduction: 169 tests removed. 38 empty classes cleaned up. Collected before: 12,522 tests Collected after: 12,353 tests
This commit is contained in:
parent
e33cb65a98
commit
2367c6ffd5
21 changed files with 0 additions and 1946 deletions
|
|
@ -83,34 +83,6 @@ class TestClient:
|
|||
assert h["Authorization"] == "Bearer rdb-test-key"
|
||||
assert h["X-API-Key"] == "rdb-test-key"
|
||||
|
||||
def test_query_context_builds_correct_payload(self):
|
||||
c = self._make_client()
|
||||
with patch.object(c, "request") as mock_req:
|
||||
mock_req.return_value = {"results": []}
|
||||
c.query_context("user1", "sess1", "test query", max_tokens=500)
|
||||
mock_req.assert_called_once_with("POST", "/v1/context/query", json_body={
|
||||
"project": "test",
|
||||
"query": "test query",
|
||||
"user_id": "user1",
|
||||
"session_id": "sess1",
|
||||
"include_memories": True,
|
||||
"max_tokens": 500,
|
||||
})
|
||||
|
||||
def test_search_builds_correct_payload(self):
|
||||
c = self._make_client()
|
||||
with patch.object(c, "request") as mock_req:
|
||||
mock_req.return_value = {"results": []}
|
||||
c.search("user1", "sess1", "find this", top_k=5)
|
||||
mock_req.assert_called_once_with("POST", "/v1/memory/search", json_body={
|
||||
"project": "test",
|
||||
"query": "find this",
|
||||
"user_id": "user1",
|
||||
"session_id": "sess1",
|
||||
"top_k": 5,
|
||||
"include_pending": True,
|
||||
})
|
||||
|
||||
def test_add_memory_tries_fallback(self):
|
||||
c = self._make_client()
|
||||
call_count = 0
|
||||
|
|
@ -141,40 +113,6 @@ class TestClient:
|
|||
assert result == {"deleted": True}
|
||||
assert call_count == 2
|
||||
|
||||
def test_ingest_session_payload(self):
|
||||
c = self._make_client()
|
||||
with patch.object(c, "request") as mock_req:
|
||||
mock_req.return_value = {"status": "ok"}
|
||||
msgs = [{"role": "user", "content": "hi"}]
|
||||
c.ingest_session("u1", "s1", msgs, timeout=10.0)
|
||||
mock_req.assert_called_once_with("POST", "/v1/memory/ingest/session", json_body={
|
||||
"project": "test",
|
||||
"session_id": "s1",
|
||||
"user_id": "u1",
|
||||
"messages": msgs,
|
||||
"write_mode": "sync",
|
||||
}, timeout=10.0)
|
||||
|
||||
def test_ask_user_payload(self):
|
||||
c = self._make_client()
|
||||
with patch.object(c, "request") as mock_req:
|
||||
mock_req.return_value = {"answer": "test answer"}
|
||||
c.ask_user("u1", "who am i?", reasoning_level="medium")
|
||||
mock_req.assert_called_once()
|
||||
call_kwargs = mock_req.call_args
|
||||
assert call_kwargs[1]["json_body"]["reasoning_level"] == "medium"
|
||||
|
||||
def test_get_agent_model_path(self):
|
||||
c = self._make_client()
|
||||
with patch.object(c, "request") as mock_req:
|
||||
mock_req.return_value = {"memory_count": 3}
|
||||
c.get_agent_model("hermes")
|
||||
mock_req.assert_called_once_with(
|
||||
"GET", "/v1/memory/agent/hermes/model",
|
||||
params={"project": "test"}, timeout=4.0
|
||||
)
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
# _WriteQueue tests
|
||||
# ===========================================================================
|
||||
|
|
@ -413,22 +351,6 @@ class TestRetainDBMemoryProvider:
|
|||
assert "Active" in block
|
||||
p.shutdown()
|
||||
|
||||
def test_tool_schemas_count(self, tmp_path, monkeypatch):
|
||||
p = self._make_provider(tmp_path, monkeypatch)
|
||||
schemas = p.get_tool_schemas()
|
||||
assert len(schemas) == 10 # 5 memory + 5 file tools
|
||||
names = [s["name"] for s in schemas]
|
||||
assert "retaindb_profile" in names
|
||||
assert "retaindb_search" in names
|
||||
assert "retaindb_context" in names
|
||||
assert "retaindb_remember" in names
|
||||
assert "retaindb_forget" in names
|
||||
assert "retaindb_upload_file" in names
|
||||
assert "retaindb_list_files" in names
|
||||
assert "retaindb_read_file" in names
|
||||
assert "retaindb_ingest_file" in names
|
||||
assert "retaindb_delete_file" in names
|
||||
|
||||
def test_handle_tool_call_not_initialized(self):
|
||||
p = RetainDBMemoryProvider()
|
||||
result = json.loads(p.handle_tool_call("retaindb_profile", {}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue