test: isolate embedding module state with monkeypatch

Agent-Logs-Url: https://github.com/MemPalace/mempalace/sessions/3213a67a-6871-4bb2-9ae0-23fa11001a22

Co-authored-by: igorls <4753812+igorls@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-24 23:11:29 +00:00
committed by GitHub
parent 3d529e7028
commit 031512438e
+3 -6
View File
@@ -4,12 +4,9 @@ import mempalace.embedding as embedding
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def clear_embedding_state(): def isolate_embedding_state(monkeypatch):
embedding._EF_CACHE.clear() monkeypatch.setattr(embedding, "_EF_CACHE", {})
embedding._WARNED.clear() monkeypatch.setattr(embedding, "_WARNED", set())
yield
embedding._EF_CACHE.clear()
embedding._WARNED.clear()
def test_auto_picks_cuda(monkeypatch): def test_auto_picks_cuda(monkeypatch):