What problem does it solve?
This Skill provides best practices and patterns for writing robust, maintainable, and efficient Python tests using pytest, reducing common pitfalls and improving code quality.
Core Features & Use Cases
- Standardized Test Structure: Enforces consistent patterns for test functions, avoiding class-based tests and module-level docstrings.
- Mocking Best Practices: Guides users to leverage
pytest-mock's mocker fixture over unittest.mock and prioritize HTTP-layer mocking.
- Factory and Fixture Patterns: Demonstrates effective use of Factory Boy for test data generation and fixture composition for complex setups.
- Use Case: When developing a new Django feature, use this Skill to ensure all associated tests follow established patterns for views, services, and data setup, leading to a more reliable codebase.
Quick Start
Use the pytest skill to write a new test for a Django view that requires authentication.