Mark backend SQLite request-scoping task done and clean up test fixture
This commit is contained in:
@@ -69,12 +69,12 @@ async def client(test_settings: Settings) -> AsyncClient: # type: ignore[misc]
|
||||
"""
|
||||
app = create_app(settings=test_settings)
|
||||
|
||||
# Bootstrap the database on app.state so Depends(get_db) works in tests.
|
||||
# The ASGI lifespan is not triggered by ASGITransport, so we do this here.
|
||||
# Bootstrap the database schema before making requests. ASGITransport
|
||||
# does not run the application lifespan, so we create the test SQLite file
|
||||
# directly rather than relying on startup logic.
|
||||
db: aiosqlite.Connection = await aiosqlite.connect(test_settings.database_path)
|
||||
db.row_factory = aiosqlite.Row
|
||||
await init_db(db)
|
||||
app.state.db = db
|
||||
|
||||
transport: ASGITransport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as ac:
|
||||
|
||||
Reference in New Issue
Block a user