ericrisco/rsc-harness / skills/testing-py
testing-py
FlaggedUse when writing or fixing Python tests with pytest — especially when the suite is green but bugs still ship, when you must decide where to patch a mocked dependency, when coverage is high but catches nothing, when fixture scope leaks state, or when adding property-based tests for parsers and invariants. NOT browser end-to-end flows (that is `e2e-testing`), NOT JS/TS unit tests (that is `testing-web`), NOT Go tests (that is `testing-go`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.6 KB |
| evals/README.md | markdown | 1.1 KB |
| evals/cases.yaml | config | 3.1 KB |
| references/mocking.md | markdown | 5.7 KB |
| references/property-testing.md | markdown | 4.4 KB |
| scripts/verify.shexecutable | script | 4.9 KB |
evals/cases.yaml
View on GitHubskill: testing-py
should_trigger:
- prompt: "Write a pytest suite for this payment parser, with fixtures and a coverage gate."
why: "Core duty: authoring a real pytest suite with fixtures and meaningful coverage."
- prompt: "My mock passes but the real function is broken — why doesn't the test catch it?"
why: "Non-obvious: the false-green symptom of patch-at-the-wrong-place and missing autospec, without the user naming either."
- prompt: "Coverage says 95% but we keep shipping bugs in the error path."
why: "Branch-coverage gap — line coverage lies about the unhit except/else arm; this skill's posture is --cov-branch."
- prompt: "Add property-based tests for our base64 encoder/decoder."
why: "Hypothesis roundtrip property over an input space a fixed matrix can't cover."
- prompt: "Mis tests comparten estado entre ejecuciones y fallan aleatoriamente."
why: "Spanish + non-obvious: fixture scope / autouse state-leak diagnosis described by symptom, not tool."
- prompt: "Com mockejo la crida HTTP a Stripe en aquest mòdul de Python?"
why: "Catalan: mocking a boundary in a Python module — patch-where-used + autospec the client."
should_not_trigger:
- prompt: "Write Playwright tests for the checkout flow across three pages."
route_to: "e2e-testing"
why: "Real browser, multi-page user flow — that is end-to-end, not pytest unit/integration."
- prompt: "Add Vitest tests for my React hook with React Testing Library."
route_to: "testing-web"
why: "JS/TS unit tests in the frontend toolchain, not Python/pytest."
- prompt: "Write table-driven tests for my Go service using testify."
route_to: "testing-go"
why: "Non-Python: Go's testing package and testify are owned by testing-go."
- prompt: "Refactor this Python module to be more idiomatic and add type hints."
route_to: "python"
why: "Language idiom and typing, not test technique; python carries the baseline."
- prompt: "Review my PR for correctness bugs across the diff."
route_to: "code-review"
why: "General correctness review of a diff, not authoring or fixing a test suite."
capability:
- scenario: "A module does `from httpx import Client` and calls `Client().get(url)`, raising on a
non-200 status. Write a unit test that mocks the HTTP call correctly, plus a coverage command
that proves the untested error branch is caught. Include at least one error-path test."
must_include:
- "patches the name in the module under test (the use site, e.g. mymod.Client), NOT httpx.Client globally — or injects the client as a dependency"
- "uses autospec=True / create_autospec so a wrong signature or typo'd method fails the test"
- "the coverage command includes --cov-branch (or the config sets branch = true)"
- "asserts on the return value / observable behavior, not on mock private internals like _mock_calls"
- "mentions a strict posture: --strict-markers and/or --strict-config (or the pytest 9 strict_* aliases)"
- "at least one negative/error-path test (e.g. raises on non-200), not only the happy path"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |