What problem does it solve?
This Skill provides structured testing patterns for Python backend projects using pytest, enabling teams to write clear unit tests for services and repositories, robust integration tests with httpx.AsyncClient, and maintainable test infrastructure with fixtures and factory_boy.
Core Features & Use Cases
- Unit testing patterns for services and repositories, including fixture organization and test structure.
- Integration testing with httpx.AsyncClient for FastAPI endpoints, including realistic request/response simulations.
- Factory and mocking strategies using factory_boy and pytest-mock to create repeatable test data and isolate logic.
- Test organization and coverage guidelines covering tests/unit, tests/integration, conftest hierarchy, and coverage thresholds.
Quick Start
Install the required testing libraries (pytest, pytest-asyncio, httpx, factory_boy) and create tests under tests/unit and tests/integration. Run pytest to execute patterns and generate a coverage report.