Skip to content

Python Testing with pytest

Write and improve Python tests using pytest fixtures, parametrization, mocking, coverage and async patterns

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

Once installed, the agent follows a set of pytest best practices when you ask it to write or improve Python tests. It knows how to structure test files and functions, reuse setup code with fixtures, run one test with many inputs, replace real dependencies with mocks, measure coverage, and test async code. The skill is a set of written guidance and code examples; it does not run anything by itself.

Great for

  • Python developers who want consistent, idiomatic pytest tests written by an agent
  • Teams adding test coverage to an existing Python project
  • Developers learning pytest conventions such as fixtures and markers

Skip it if

  • Projects that do not use Python or pytest (the guidance is specific to both)
  • Teams that need a different framework such as unittest-only conventions, because the skill recommends pytest as the primary tool
  • Anyone expecting the skill to run tests or verify coverage on its own; the agent must still execute pytest commands in your environment

Try asking

  • “Write pytest unit tests for my UserService class using fixtures and mocks”
  • “Add parametrized tests for my email validation function”
  • “Set up pytest-cov so the build fails below 80% coverage”
  • “Write async tests for my FastAPI client using pytest-asyncio”
Step-by-step guide: how to use Python Testing with pytestInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    python-testing.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip python-testing.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip python-testing.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Name the module or class you want tested so the agent can reference real code instead of the generic examples
  • Ask the agent to run pytest afterwards so you can confirm the tests pass in your own project
  • Review generated fixtures and mocks, since examples use placeholder names like User and Database that must match your code

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.