"""Shared fixtures and sys.modules pre-mocking for the ArchiveAI-TTS test suite.""" import sys from unittest.mock import MagicMock import pytest def _mock_if_unimportable(name: str) -> None: if name in sys.modules: return try: __import__(name) except (ImportError, ModuleNotFoundError): sys.modules[name] = MagicMock() # Mock only when not installed, so real environments use the real package. for _pkg in ["elevenlabs", "gradio", "soundfile"]: _mock_if_unimportable(_pkg) @pytest.fixture def tmp_dir(tmp_path): return tmp_path