pytest-testing-assistant
Pytest Testing Assistant
Quick start
- Write tests as plain functions; do not use test classes. Aim for one focused test per function/behavior.
- Use clear names:
test_<function>_<behavior>; keep AAA (arrange/act/assert) obvious. - Prefer one primary assertion per test; add minimal supporting checks when necessary.
- Use fixtures sparingly to keep tests readable; favor in-test setup when simple.
- Run with
pytestorpytest path/to/test_file.pyto scope runs. - See
references/pytest_rules.mdfor detailed guidelines and examples.
Workflow
-
Identify behavior
- Target a single function/behavior per test. Name the test after the behavior being validated.
-
Write the test
- Use a standalone function
def test_<thing>():(no classes). - Keep a clear arrange/act/assert structure; avoid hidden work in fixtures unless it improves clarity.
- Use parametrization for small input/output matrices instead of loops.
- Use a standalone function
-
Assertions
- Prefer one main assertion; add secondary checks only when they clarify the outcome.
- Include helpful assertion messages or use expressive matchers for readability.
-
Run and iterate
- Run
pytest(optionally narrow with paths or-kexpressions). - Refine names and setup for readability and isolation.
- Run
Reference
references/pytest_rules.md: structure rules, naming patterns, and usage tips.
More from dmitriiweb/extract-emails
google-docstring-assistant
Write Python docstrings following the Google Python Style Guide, using clear sections and examples.
10format-lint-assistant
Run the project's formatter, linters, and mypy checks in the required order, fixing issues and managing any needed stub dependencies via uv.
4skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
3code-review-assistant
Perform structured, actionable code reviews for Python code with clear findings and suggestions.
3debug-logging-assistant
Add purposeful debug logging to improve observability without changing behavior.
3git-commit-assistant
Generate high-quality conventional git commit messages and, with user approval, run the commit. Use when drafting or refining commit messages, validating commit quality, or committing staged work while avoiding noisy histories.
3