pytest skill

This commit is contained in:
John Lancaster
2026-06-19 17:39:57 -05:00
parent ed6068f398
commit 5c4de7b721
3 changed files with 13 additions and 36 deletions
@@ -7,6 +7,19 @@
- [Configuration reference](https://docs.pytest.org/en/stable/reference/customize.html)
- [Flaky tests](https://docs.pytest.org/en/stable/explanation/flaky.html)
## Agent Quick Path
Use this file when you need fast pytest scaffolding defaults without framework-specific details.
1. Mirror source layout under `tests/`.
2. Keep fixtures small and explicit; default to `function` scope.
3. Register markers up front in `pyproject.toml`.
4. Validate structure first with `uv run pytest --collect-only -q`.
5. Run fast lane with `uv run pytest -m unit -q`.
Load other references only when needed:
- FastAPI routes/dependency injection/lifespan: `fastapi-testing.md`
- SQLAlchemy sessions/transactions/DB fixtures: `sqlalchemy-testing.md`
## Practical Guidance For This Skill
- Use src-aligned test layout and keep test discovery conventional.
- Keep fixtures small, composable, and explicit; use `yield` for teardown.