test: SessionDB doubles accept the read_only kwarg / registry acquire the CLI now uses

_resolve_last_session attaches read-only and oneshot borrows the registry
handle, so the fakes that stood in for a bare SessionDB() follow suit.
This commit is contained in:
teknium1
2026-09-14 07:39:57 -07:00
committed by Teknium
parent 1ce2d25237
commit d4063e6260
2 changed files with 5 additions and 5 deletions
@@ -131,5 +131,5 @@ def test_resolve_last_session_real_db_prefers_workspace(monkeypatch, tmp_path):
cmd, 0, stdout=str(repo_a), stderr=""
),
)
monkeypatch.setattr("hermes_state.SessionDB", lambda: real_db(db_path=state_db))
monkeypatch.setattr("hermes_state.SessionDB", lambda **kw: real_db(db_path=state_db, **kw))
assert _resolve_last_session("cli") == "repo_a"
+4 -4
View File
@@ -167,9 +167,8 @@ def test_oneshot_wires_session_db_for_recall(monkeypatch):
captured["prompt"] = prompt
return {"final_response": "ok", "failed": False, "partial": False}
class FakeSessionDB:
def __new__(cls):
return sentinel_db
def fake_acquire(db_path=None):
return sentinel_db
def mod(name, **attrs):
module = types.ModuleType(name)
@@ -178,7 +177,8 @@ def test_oneshot_wires_session_db_for_recall(monkeypatch):
return module
monkeypatch.setitem(sys.modules, "run_agent", mod("run_agent", AIAgent=FakeAgent))
monkeypatch.setitem(sys.modules, "hermes_state", mod("hermes_state", SessionDB=FakeSessionDB))
# Oneshot borrows the process-shared registry handle (one writer per state.db path).
monkeypatch.setitem(sys.modules, "hermes_state_registry", mod("hermes_state_registry", acquire=fake_acquire))
monkeypatch.setitem(
sys.modules,
"hermes_cli.config",