From 261a1f3918fd179b25ced9bc30995333256da7c8 Mon Sep 17 00:00:00 2001 From: Francwa Date: Sat, 27 Dec 2025 19:48:13 +0100 Subject: [PATCH] fix: fixed real data directory being used in tests --- tests/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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."""