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:
2025-09-23 23:39:24 -06:00
parent 2aa99fe846
commit 27f19ec6ba
3 changed files with 19 additions and 6 deletions

View File

@@ -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