- Config audio_stream_default=True; _run_turn nutzt es, wenn die Anfrage audio_stream nicht explizit setzt (explizite Anfrage gewinnt) - voice_loop: immer durchgehender Player (spielt 1 oder N Haeppchen luekenlos); --stream-audio / --no-stream-audio als Tri-State (sonst entscheidet der Server-Default) - conftest: audio_stream_default=False fuer deterministische Tests; neuer Test fuer Default-an-Streaming ueber /ws/voice; 67 Tests gruen - Doku + .env.example aktualisiert (AUDIO_STREAM_DEFAULT, --no-stream-audio) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import pytest
|
|
|
|
import app.dependencies as deps
|
|
from app.config import settings
|
|
from app.store import SQLiteStore
|
|
from app.metrics import metrics
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def reset_state(tmp_path, monkeypatch):
|
|
"""Pro Test: frische SQLite-DB, frischer Singleton-Audio-Router, Auth aus, Metriken leer.
|
|
|
|
Auth-Tests schalten `settings.auth_enabled` selbst wieder ein.
|
|
"""
|
|
deps._store = SQLiteStore(str(tmp_path / "test.db"))
|
|
deps._audio_router = None
|
|
metrics.reset()
|
|
monkeypatch.setattr(settings, "auth_enabled", False)
|
|
monkeypatch.setattr(settings, "admin_api_key", "")
|
|
# deterministische Event-Reihenfolge in Tests; Stream-Tests setzen es explizit
|
|
monkeypatch.setattr(settings, "audio_stream_default", False)
|
|
yield
|
|
deps._store = None
|
|
deps._audio_router = None
|
|
|
|
|
|
def loopback_output():
|
|
"""Liefert den LoopbackOutput aus dem aktuellen Singleton-Router."""
|
|
router = deps.get_audio_router()
|
|
for endpoint in router.outputs:
|
|
if type(endpoint).__name__ == "LoopbackOutput":
|
|
return endpoint
|
|
raise AssertionError("LoopbackOutput nicht gefunden")
|