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

@ -24,7 +24,7 @@ async def session():
engine = create_async_engine("sqlite+aiosqlite:///:memory:")
async with engine.begin() as conn:
await conn.run_sync(SQLModel.metadata.create_all)
async with AsyncSession(engine) as session:
async with AsyncSession(engine, expire_on_commit=False) as session:
yield session