mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
fix: improve session management and testing infrastructure
- Split get_session into _get_session and get_session to facilitate test mocking - Add autouse fixture to ensure db_session is properly injected in tests - Fix generate_waveform method to accept session parameter explicitly
This commit is contained in:
@@ -344,6 +344,15 @@ def celery_includes():
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def ensure_db_session_in_app(db_session):
|
||||
async def mock_get_session():
|
||||
yield db_session
|
||||
|
||||
with patch("reflector.db._get_session", side_effect=mock_get_session):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def client(db_session):
|
||||
from httpx import AsyncClient
|
||||
|
||||
Reference in New Issue
Block a user