From 031512438ea96967c7b413bcff0c16cfaddef5ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:11:29 +0000 Subject: [PATCH] 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> --- tests/test_embedding.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/test_embedding.py b/tests/test_embedding.py index 4936a75..d05075d 100644 --- a/tests/test_embedding.py +++ b/tests/test_embedding.py @@ -4,12 +4,9 @@ import mempalace.embedding as embedding @pytest.fixture(autouse=True) -def clear_embedding_state(): - embedding._EF_CACHE.clear() - embedding._WARNED.clear() - yield - embedding._EF_CACHE.clear() - embedding._WARNED.clear() +def isolate_embedding_state(monkeypatch): + monkeypatch.setattr(embedding, "_EF_CACHE", {}) + monkeypatch.setattr(embedding, "_WARNED", set()) def test_auto_picks_cuda(monkeypatch):