python-testing
Installation
SKILL.md
Python Testing Skill
Generate high-quality pytest tests following best practices for this project.
Core Principles
-
Minimal Mocking: Only mock external dependencies (APIs, databases, file I/O). Test with real Python objects whenever possible. Mocking internal logic can hide breaking changes.
-
Parametrization: Use
@pytest.mark.parametrizefor testing multiple cases instead of writing separate test functions. Keeps tests DRY and readable. -
Shared Fixtures in conftest.py: Place reusable fixtures in
conftest.pyto avoid duplication. Fixtures are automatically discovered by pytest. -
1-1 File Correspondence: Each source file has a corresponding test file (
src/game.py→tests/test_game.py).