python-testing-conventionslisted
Install: claude install-skill TheodoreAD/agent-skills
# Python testing defaults
Personal, agent-maintained Python projects. Split out of `python-conventions` on 2026-08-31, which
keeps the design and style defaults; this skill owns the test suite. Nothing here is tool config —
pytest's own configuration lives with the repo's quality tooling, not here.
**Each entry says whether it's overriding your own default instinct or just confirming one.** A
capable model already parametrizes value matrices and reaches for `tmp_path` unprompted. This skill
exists for the places a model left alone drifts — inlining the same arrange block into every test
rather than promoting it to a fixture, and reaching for a mock where the suite could own the real
thing.
## Testing conventions
- Snippet: [`references/snippets/testing.py`](references/snippets/testing.py)
- Fixtures first, always. Any setup a test needs — a tmp tree, a fake `HOME`, a stubbed `c.run`, a
constructed object, a monkeypatched env — is a `pytest` fixture (in `conftest.py` once two files
want it), not lines hand-rolled at the top of each test body. Two reasons, and the second is the
bigger one: it removes the mechanical duplication, and it **surfaces when the suite is doing the
same thing three different ways** — three hand-rolled versions of "make a fake repo" hide in three
test bodies indefinitely; three fixtures named `fake_repo`, `tmp_repo`, and `repo_dir` sit next to
each other in `conftest.py` and get merged. Reach for the built-ins (`tmp_path`, `monkeypatch`,