Python unit testing patterns for pytest, including test file structure, fixtures, mocks, and coverage strategy. Use when asked to write tests (unit/integration) for any Python module, function, class, or method.
Provides Python unit testing patterns for pytest, including test file structure, fixtures, mocks, and coverage strategy. Use when asked to write tests (unit/integration) for any Python module, function, class, or method.
/plugin marketplace add MacHu-GWU/sanhe-claude-code-plugins/plugin install sanhe-py-best-practices@sanhe-claude-code-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
reference/coverage.mdreference/naming.mdreference/public-api.mdOrganized testing strategy for Python projects: test file naming, coverage goals (95%+), and public API testing.
Find test location for any source file:
When being asked to write tests for a specific source file, use the following command to determine the correct test file path based on established naming conventions:
uvx --from shai-py==0.1.1 shai-py test-path /path/to/my_package/subpackage/module.py
Run tests:
.venv/bin/python tests/subpackage/test_*.py.venv/bin/python tests/subpackage/all.py.venv/bin/python tests/all.pysource/<pkg>/<module>.py → tests/<pkg>/test_<pkg>_<module>.pyapi.py, test in tests/test_api.pyThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.