CI / ruff · pytest (pull_request) Successful in 2m33s
- CRISIS_BLOCKING (default off for the demo): a crisis no longer locks the dialog; the message and the doctor's acute alert still happen. The clinical protocol (blocking, immediate stop) stays behind the flag and keeps its tests. - Crisis signals inside a questionnaire (intake red flags, high C-SSRS, PHQ-9 item 9) no longer stop it: the test is finished and the crisis message comes at the end; the doctor's alert is raised at once/at the end. - Weapon access: asked and stored, triggers nothing (rule disabled, no red flag, no safety block). - ЕМИАС demo persona is «Никита В.»; the one-click demo stays «Андрей С.». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
784 B
Python
20 lines
784 B
Python
"""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")
|
|
# Tests cover the clinical protocol by default (blocking crisis); demo-mode tests flip it explicitly.
|
|
monkeypatch.setenv("CRISIS_BLOCKING", "true")
|
|
get_settings.cache_clear()
|
|
yield
|
|
get_settings.cache_clear()
|