From b4025b8a415bd2f4bbe3180697e15b6d9237b44a Mon Sep 17 00:00:00 2001 From: anti Date: Tue, 19 May 2026 10:21:37 -0400 Subject: [PATCH] Fix test isolation: redirect hits.db to tmp_path in web RBAC tests Dashboard route queries utils.database, which was pointing at the real data/hits.db instead of a temp file, causing no such table: hits. --- tests/test_web_rbac.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_web_rbac.py b/tests/test_web_rbac.py index 17e55a8..2f140ae 100644 --- a/tests/test_web_rbac.py +++ b/tests/test_web_rbac.py @@ -18,10 +18,16 @@ def isolated_web(tmp_path, monkeypatch): db_path = tmp_path / "web.db" cfg_path = tmp_path / "runtime_config.json" + import utils.database as hitdb_mod + + hits_path = tmp_path / "hits.db" + monkeypatch.setattr(db_mod, "DB_FILE", db_path) monkeypatch.setattr(cfg_mod, "RUNTIME_CONFIG_PATH", cfg_path) + monkeypatch.setattr(hitdb_mod, "DB_FILE", hits_path) db_mod.init_db() + hitdb_mod.init_db() @pytest.fixture