From 04dd80a977f40b05e5b2054111747af07a61886a Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 11 Sep 2026 03:33:19 -0700 Subject: [PATCH] test(web): count only the dashboard's own warning in the corrupt-store poll test hermes_state emits a once-per-process SQLite-version advisory on CI's linked 3.50.4, which caplog captured as a second WARNING. Scope the assertion to the hermes_cli.web_server logger the router actually writes to. --- tests/hermes_cli/test_web_analytics_corrupt_store.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/hermes_cli/test_web_analytics_corrupt_store.py b/tests/hermes_cli/test_web_analytics_corrupt_store.py index d1cd877ed0..d2214be81f 100644 --- a/tests/hermes_cli/test_web_analytics_corrupt_store.py +++ b/tests/hermes_cli/test_web_analytics_corrupt_store.py @@ -44,7 +44,12 @@ def test_corrupt_store_polls_return_status_and_warn_once_per_interval(tmp_path, assert resp.status_code == 503 assert resp.json()["detail"]["error"] == "state_db_corrupt" assert "hermes doctor" in resp.json()["detail"]["message"] - warnings = [r for r in caplog.records if r.levelno >= logging.WARNING] + # Only the dashboard's own warning counts: hermes_state logs an unrelated + # once-per-process SQLite-version advisory on some interpreters (CI's 3.50.4). + warnings = [ + r for r in caplog.records + if r.levelno >= logging.WARNING and r.name.startswith("hermes_cli.web_server") + ] assert len(warnings) == 1, [r.getMessage() for r in warnings] assert not any(r.exc_info for r in caplog.records), "no tracebacks for a known corrupt store" assert db_path.exists() and db_path.stat().st_size > 0, "dashboard must never quarantine the file" @@ -54,4 +59,7 @@ def test_corrupt_store_polls_return_status_and_warn_once_per_interval(tmp_path, caplog.clear() with caplog.at_level(logging.WARNING, logger="hermes_cli.web_server"): assert client.get("/api/analytics/usage?days=7").status_code == 503 - assert sum(r.levelno >= logging.WARNING for r in caplog.records) == 1 + assert sum( + r.levelno >= logging.WARNING and r.name.startswith("hermes_cli.web_server") + for r in caplog.records + ) == 1