Skip to content

Commit 888bcdc

Browse files
ambvclaude
andcommitted
Document how to run backend tests and describe the test architecture
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5a02cf0 commit 888bcdc

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,28 @@ Services start automatically with hot reload:
3535
## Development Commands
3636

3737
### Testing
38+
3839
```bash
39-
npm run lint # Frontend linting (in frontend directory)
40-
npm run typecheck # TypeScript type checking
40+
# Backend tests
41+
docker compose -f docker-compose.dev.yml exec backend python -m pytest tests/ -v
42+
43+
# With coverage report
44+
docker compose -f docker-compose.dev.yml exec backend python -m pytest tests/ --cov=app --cov-report=term-missing
45+
46+
# Frontend checks
47+
docker compose -f docker-compose.dev.yml exec frontend npm run lint
48+
docker compose -f docker-compose.dev.yml exec frontend npm run typecheck
4149
```
4250

51+
Backend tests use an in-memory SQLite database, independent of the
52+
PostgreSQL instance used in development. Each test gets a fresh database
53+
with empty tables. Fixtures in `backend/tests/conftest.py` provide
54+
pre-built model instances (commits, binaries, environments, runs,
55+
benchmark results, auth tokens) that tests can depend on as needed.
56+
Requests go through `httpx.AsyncClient` with FastAPI's ASGI transport,
57+
so the full request/response cycle (middleware, dependency injection,
58+
validation) is exercised without a running server.
59+
4360
### Populating Mock Data
4461
```bash
4562
docker compose -f docker-compose.dev.yml exec backend python scripts/populate_db.py

0 commit comments

Comments
 (0)