mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-22 13:19:05 +00:00
fix: resolve event loop isolation issues in test suite
- Add session-scoped event loop fixture to prevent 'Event loop is closed' errors - Use NullPool for database connections to avoid asyncpg connection caching issues - Override session.commit with flush in tests to maintain transaction rollback - Configure pytest-asyncio with session-scoped loop defaults - Fixes 'coroutine Connection._cancel was never awaited' warnings - Properly dispose of database engines after each test Results: 137 tests passing (up from 116), only 8 failures remaining This addresses the SQLAlchemy 2.0 async session lifecycle issues with asyncpg
This commit is contained in:
@@ -117,6 +117,7 @@ DATABASE_URL = "postgresql+asyncpg://test_user:test_password@localhost:15432/ref
|
||||
addopts = "-ra -q --disable-pytest-warnings --cov --cov-report html -v"
|
||||
testpaths = ["tests"]
|
||||
asyncio_mode = "auto"
|
||||
asyncio_default_fixture_loop_scope = "session"
|
||||
markers = [
|
||||
"model_api: tests for the unified model-serving HTTP API (backend- and hardware-agnostic)",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user