fix: fixed real data directory being used in tests

This commit is contained in:
2025-12-27 19:48:13 +01:00
parent 253903a1e5
commit 261a1f3918

View File

@@ -21,6 +21,16 @@ def temp_dir():
shutil.rmtree(dirpath) shutil.rmtree(dirpath)
@pytest.fixture(autouse=True)
def mock_memory_storage_dir(monkeypatch):
"""Override MEMORY_STORAGE_DIR for all tests to use a temp directory."""
test_dir = tempfile.mkdtemp()
monkeypatch.setenv("MEMORY_STORAGE_DIR", test_dir)
yield
# Cleanup
shutil.rmtree(test_dir, ignore_errors=True)
@pytest.fixture @pytest.fixture
def memory(temp_dir): def memory(temp_dir):
"""Create a fresh Memory instance for testing.""" """Create a fresh Memory instance for testing."""