Merge pull request 'test: без живых вызовов LLM в тестах' (#76) from fix/tests-no-live-llm into dev
CI / ruff · pytest (push) Successful in 1m53s
CI / ruff · pytest (push) Successful in 1m53s
This commit was merged in pull request #76.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
"""Test-wide isolation: a developer's local `.env` (e.g. OPENROUTER_API_KEY) must never make tests call a real
|
||||||
|
LLM provider — that costs money and makes results depend on the network. Agent tests pass explicit
|
||||||
|
providers/settings; everything else runs with the chat agent off."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from app.config import get_settings
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def _no_live_llm(monkeypatch: pytest.MonkeyPatch):
|
||||||
|
monkeypatch.setenv("CHAT_AGENT", "off")
|
||||||
|
monkeypatch.setenv("OPENROUTER_API_KEY", "")
|
||||||
|
monkeypatch.setenv("LLM_PROVIDER", "mock")
|
||||||
|
get_settings.cache_clear()
|
||||||
|
yield
|
||||||
|
get_settings.cache_clear()
|
||||||
Reference in New Issue
Block a user