Files
yunke/yunke-server/tests/conftest.py
T
浅念 b9fcf17ae4 feat: db base + config tests
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-01 11:04:44 +08:00

18 lines
513 B
Python

"""Shared pytest fixtures for the yunke-server test suite."""
import pytest
from app.config import get_settings
@pytest.fixture(autouse=True)
def reset_settings_cache():
"""Ensure each test starts with a fresh Settings cache.
Tests that mutate env vars and call `get_settings()` must also clear the
`lru_cache` themselves; this fixture is a safety net that runs after every
test so a cached `Settings` from one test never leaks into the next.
"""
yield
get_settings.cache_clear()