Pytest Testing — Claude Code skill: pytest tests, fixtures, mocks
A skill for writing pytest tests: fixtures, mocks, coverage and CI runs. Useful when a Python project's tests need structure.
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a claude-codeWhat Pytest Testing does
The skill walks through pytest topic by topic: basic tests and parametrization, fixtures with different scopes, replacing external dependencies with unittest.mock, measuring coverage, and running tests in a pipeline. It ships code examples and a pytest.ini setup with a coverage threshold and HTML and XML reports.
There are hands-on projects too: a calculator built with TDD and a test suite for a REST API. The first asks you to write tests before the implementation, the second to cover requests and responses. This is not a syntax reference — it is a set of scenarios to work through with the agent.
Coverage measurement needs pytest-cov; CI runs need pytest in the environment. The skill is bonded to the 04-testing-quality subagent through PRIMARY_BOND, so pairing them keeps behaviour predictable.
What it helps with
- write tests before the implementation in TDD style
- move shared fixtures into
conftest.py - mock HTTP calls and assert they happened once
- set a coverage threshold in
pytest.ini - run tests in GitHub Actions with a coverage report
Example prompts for the agent
- Write tests for
calculator.pyTDD-style: tests first, then the implementation. - Move the sample users fixture into
conftest.pyand use it intest_users.py. - Mock
requests.getinapi_client.pyand assert it was called once.
How to install Pytest Testing
1Skills CLI (Vercel)
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a claude-code2Manually: put the files in place
~/.claude/skills/pytest-testing/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pytest-testing/
1Skills CLI (Vercel)
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a codex2Manually: put the files in place
.agents/skills/pytest-testing/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a cursor2Manually: put the files in place
.cursor/skills/pytest-testing/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install pluginagentmarketplace/custom-plugin-python pytest-testing2Manually: put the files in place
.github/skills/pytest-testing/SKILL.md1Skills CLI (Vercel)
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a gemini-cli2Platform CLI
gemini skills install https://github.com/pluginagentmarketplace/custom-plugin-python --path skills/pytest-testingManually: put the files in place
.devin/skills/pytest-testing/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about Pytest Testing
How do I install Pytest Testing in Claude Code?
Run npx skills add pluginagentmarketplace/custom-plugin-python --skill pytest-testing -a claude-code. The skill file lands at ~/.claude/skills/pytest-testing/SKILL.md.
What does the Pytest Testing skill do?
It helps write pytest tests: fixtures, parametrization, mocks, coverage measurement and CI wiring. Code examples and hands-on projects are included.
What do I need for the skill to work?
pytest in the project environment, and pytest-cov for coverage. The skill is bonded to the 04-testing-quality subagent.