Skip to content

Commit 3f0a2b9

Browse files
committed
fix(test): patch MEMORY_INDEX alongside MEMORY_DIR in import tests
The two new memory_import tests monkeypatched mem.MEMORY_DIR but not mem.MEMORY_INDEX (a Path constant frozen at import time). _write_index() inside handle_memory_import then wrote to the original ~/.tdpilot-api/memory/MEMORY.md location. On my dev machine the dir exists, so the tests silently wrote there and passed. On CI's fresh runner the dir doesn't exist → FileNotFoundError. Fix: monkeypatch both MEMORY_DIR and MEMORY_INDEX. Same pattern as the existing tests would benefit from but they don't trigger _write_index.
1 parent 1de165a commit 3f0a2b9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tests/test_tdpilot_api_memory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def test_memory_export_dumps_all_files(tmp_path, monkeypatch):
120120

121121
def test_memory_import_skips_existing_by_default(tmp_path, monkeypatch):
122122
monkeypatch.setattr(mem, "MEMORY_DIR", tmp_path)
123+
monkeypatch.setattr(mem, "MEMORY_INDEX", tmp_path / "MEMORY.md")
123124
_seed(tmp_path, "user_role.md", "old", "old body", mtype="user")
124125

125126
payload = {
@@ -145,6 +146,7 @@ def test_memory_import_skips_existing_by_default(tmp_path, monkeypatch):
145146

146147
def test_memory_import_overwrite_replaces_existing(tmp_path, monkeypatch):
147148
monkeypatch.setattr(mem, "MEMORY_DIR", tmp_path)
149+
monkeypatch.setattr(mem, "MEMORY_INDEX", tmp_path / "MEMORY.md")
148150
_seed(tmp_path, "user_role.md", "old", "old body", mtype="user")
149151

150152
payload = {

0 commit comments

Comments
 (0)