"""Unit test fixtures — sets required env vars so Settings() loads without a .env file.""" import pytest @pytest.fixture(autouse=True) def patch_settings(monkeypatch): """Provide the minimum env vars that Settings() requires for unit tests.""" monkeypatch.setenv("SECRET_KEY", "a" * 64) monkeypatch.setenv("INTERNAL_SECRET", "b" * 64) monkeypatch.setenv("DATABASE_URL", "postgresql+asyncpg://test:test@localhost/test") # Clear the lru_cache so each test gets a fresh Settings instance with the # monkeypatched env vars rather than the cached production instance. from rehearsalhub.config import get_settings get_settings.cache_clear() yield get_settings.cache_clear()