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:
committed by
GitHub
parent
3d529e7028
commit
031512438e
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user