Description
Create pytest fixtures for async database testing with in-memory SQLite.
Files
- Create:
tests/conftest.py
Fixtures
db_session — creates in-memory SQLite, creates all tables, yields session, disposes engine
client — FastAPI test client with overridden get_db dependency, uses httpx AsyncClient
sample_list — pre-created ShoppingList in the test DB
Details
- Use TEST_DATABASE_URL = "sqlite+aiosqlite://" for in-memory
- Clean up engine after each test via engine.dispose()
Acceptance Criteria
Description
Create pytest fixtures for async database testing with in-memory SQLite.
Files
tests/conftest.pyFixtures
db_session— creates in-memory SQLite, creates all tables, yields session, disposes engineclient— FastAPI test client with overridden get_db dependency, uses httpx AsyncClientsample_list— pre-created ShoppingList in the test DBDetails
Acceptance Criteria