"""Shared pytest fixtures for backend tests. All external LLM/ASR calls must be mocked. Use tmp_path for ChromaDB instances. """ import pytest from unittest.mock import AsyncMock, MagicMock @pytest.fixture def mock_llm_client(monkeypatch): """Mock LLM client to avoid hitting live APIs.""" class _Mock: async def complete(self, prompt: str, temperature: float = 0.7) -> str: # type: ignore return "{\"choices\": [{\"message\": {\"content\": \"mock response\"}}]}" return _Mock() @pytest.fixture def mock_asr_client(monkeypatch): """Mock ASR client to avoid hitting live APIs.""" class _Mock: async def transcribe(self, audio_bytes): # type: ignore return "" return _Mock() @pytest.fixture def chroma_test_dir(tmp_path): """Provide a temporary directory for isolated ChromaDB instances.""" return tmp_path / "chroma_test"