← ClaudeAtlas

python-testing-conventionslisted

Use when writing or restructuring Python tests — deciding how much duplication a test should carry before it stops being readable, what a fixture should cover and at what scope, when to parametrize instead of writing another test, whether a dependency should be doubled or run for real, and what belongs in a fast default suite versus a slower marked tier. Also for pytest specifics: fixtures, conftest placement, parametrize ids, markers, and keeping a suite from writing into the real home directory. Gives the default answer per question rather than an evaluation, so choices stay consistent across projects instead of drifting session to session, and each entry says whether it overrides a model's own instinct or just confirms it.
TheodoreAD/agent-skills · ★ 0 · Testing & QA · score 72
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`,