diff --git a/tests/conftest.py b/tests/conftest.py index ff87c6f..462d701 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,16 @@ def temp_dir(): 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 def memory(temp_dir): """Create a fresh Memory instance for testing."""