Use when
- Project uses Python + pytest.
- User asks to write/refactor/debug tests with pytest.
- User asks for TDD in Python.
- User asks for fixture design, flaky test fixes, coverage, or performance checks in pytest.
Avoid when
- Scope is not Python/pytest.
- User asks for language-agnostic TDD only (use
tdd-corefirst).
Relationship to tdd-core
- Apply
tdd-coreas the base doctrine. - This skill adds pytest-specific execution patterns.
Pytest-specific workflow
- Pick one behavior from the TDD plan.
- RED: add one failing pytest test.
- GREEN: minimal implementation to pass.
- REFACTOR: clean code/fixtures while tests stay green.
- Repeat in small vertical slices.
Pytest guardrails
- Prefer public-interface tests over internals.
- Use
@pytest.mark.parametrizefor behavior matrices. - Use Hypothesis for invariants/properties.
- Keep fixtures explicit by scope; avoid hidden coupling in
conftest.py. - Use boundary mocks only; avoid mocking your own domain modules.
See TDD_REFERENCE.md for commands and troubleshooting.
Output
- Behavior coverage for this cycle
- Test files/fixtures changed
- Commands run + results
- Remaining gaps/risks + next cycle
Source: pesap/agents — distributed by TomeVault.