1.5 KiB
1.5 KiB
title, status, type, priority, created_at, updated_at, parent, blocking
| title | status | type | priority | created_at | updated_at | parent | blocking | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Set up backend test infrastructure | draft | task | normal | 2026-02-10T09:32:57Z | 2026-02-10T09:33:59Z | nuzlocke-tracker-yzpb |
|
Set up the foundational test infrastructure for the FastAPI backend so that all subsequent test tasks can build on it.
Checklist
- Create
backend/tests/conftest.pywith shared fixtures - Set up a test database strategy (use a separate test PostgreSQL database or SQLite for speed — evaluate trade-offs)
- Create an async test client fixture using
httpx.AsyncClientwith the FastAPIapp - Create a database session fixture that creates/drops tables per test session or uses transactions for isolation
- Add factory fixtures or helpers for creating common test entities (games, pokemon, runs, etc.)
- Verify the setup works by writing a simple smoke test (e.g. health endpoint returns 200)
- Document how to run tests (e.g.
pytestfrom backend dir, any env vars needed)
Notes
- pytest, pytest-asyncio, and httpx are already in pyproject.toml dev dependencies
- AsyncIO mode is set to "auto" in pyproject.toml
- The app uses SQLAlchemy async with asyncpg — test fixtures need to handle async session management
- Consider using
SAVEPOINT-based transaction rollback for test isolation (faster than recreating tables)