From f63aca4186734513d6e7d90015eaf8e6f0903e9e Mon Sep 17 00:00:00 2001 From: anti Date: Sun, 10 May 2026 05:47:26 -0400 Subject: [PATCH] fix(test): reset _cached_backend before factory dispatch tests --- tests/realism/test_llm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/realism/test_llm.py b/tests/realism/test_llm.py index 4a91d8fb..e7b5af66 100644 --- a/tests/realism/test_llm.py +++ b/tests/realism/test_llm.py @@ -15,18 +15,21 @@ from decnet.realism.llm.impl.ollama import OllamaBackend def test_factory_default_is_ollama(monkeypatch): monkeypatch.delenv("DECNET_REALISM_LLM", raising=False) + monkeypatch.setattr("decnet.realism.llm.config._cached_backend", None) backend = get_llm() assert isinstance(backend, OllamaBackend) def test_factory_selects_fake(monkeypatch): monkeypatch.setenv("DECNET_REALISM_LLM", "fake") + monkeypatch.setattr("decnet.realism.llm.config._cached_backend", None) backend = get_llm() assert isinstance(backend, FakeBackend) def test_factory_unknown_raises(monkeypatch): monkeypatch.setenv("DECNET_REALISM_LLM", "vllm-someday") + monkeypatch.setattr("decnet.realism.llm.config._cached_backend", None) with pytest.raises(ValueError, match="Unsupported"): get_llm()