feat: db base + config tests

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-01 11:04:44 +08:00
parent 2031607beb
commit b9fcf17ae4
7 changed files with 193 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
"""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()