ref: Use AsyncSession in some tests (#5151)

This commit is contained in:
Christophe Bornet 2024-12-08 02:09:43 +01:00 • committed by GitHub
commit 624a2dde5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 53 additions and 47 deletions

View file

@ -74,7 +74,7 @@ def session_getter(db_service: DatabaseService):
@asynccontextmanager
async def async_session_getter(db_service: DatabaseService):
try:
session = AsyncSession(db_service.async_engine)
session = AsyncSession(db_service.async_engine, expire_on_commit=False)
yield session
except Exception:
logger.exception("Session rollback because of exception")