pytest

pytest is a skill for Claude Code from aks-builds/quality-skills. It costs 129 tokens per session (2,791 once invoked), scanned A, original, MIT.

A Python test runner and framework for unit and integration tests. It supports reusable fixtures, parameterized cases, asynchronous tests, and optional plugins for tasks such as parallel execution and coverage measurement.

In plain words
What is it for?
Use it to test Python libraries and web applications built with Django, FastAPI, Flask, Starlette, or no web framework. It can cover small functions, database or request behavior, asynchronous code, and test doubles.
Why use it?
It gives Python projects a consistent way to discover, organize, and run tests without requiring large test classes or much boilerplate. It also helps teams reuse setup and test the same behavior with many inputs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the quality-skills plugin — 57 skills shipped together

Good fit Use it to test Python libraries and web applications built with Django, FastAPI, Flask, Starlette, or no web framework. It can cover small functions, database or request behavior, asynchronous code, and test doubles.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aks-builds/quality-skills/pytest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add aks-builds/quality-skills --skill pytest
Clone the repo
git clone --depth 1 https://github.com/aks-builds/quality-skills

Made for: Claude Code.

Or install quality-skills, the plugin that ships this one along with the rest of its 57 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytest

README.md
[![agentmods](https://agentmods.dev/badge/skills/aks-builds/quality-skills/pytest.svg)](https://agentmods.dev/skills/aks-builds/quality-skills/pytest)
Your own site
<a href="https://agentmods.dev/skills/aks-builds/quality-skills/pytest"><img src="https://agentmods.dev/badge/skills/aks-builds/quality-skills/pytest.svg" alt="Measured on agentmods" height="20"></a>
Per session 129 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,791 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00129 $0.02791
Opus 5 $0.00064 $0.01396
Sonnet 5 $0.00026 $0.00558
Haiku 4.5 $0.00013 $0.00279

Measured 7d ago against content hash 9f8164d10889, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

pytest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pytest/SKILL.md · 343 lines

How it starts

The opening of the file, as written. The whole thing — 343 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pytest

You are an expert in pytest — Python's de facto unit and integration test runner. Your goal is to help engineers design clean fixtures, parametrize effectively, manage async tests, and pick the right plugins without overgrowing the dependency surface. Don't fabricate pytest APIs, fixture names, or plugin names. When uncertain, point the reader to docs.pytest.org.

Initial Assessment

Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:

  • Python version — pytest features are version-stable, but some plugins lag Python releases.
  • Project layoutsrc/ layout vs flat. Affects pytest's discovery.
  • Async strategypytest-asyncio (most common) vs anyio plugin for asyncio + trio cross-compat.
  • Plugins already in usepytest-xdist (parallel), pytest-cov (coverage), pytest-mock (mocker fixture), pytest-httpx / responses (HTTP mocking), pytest-django / pytest-flask (framework-specific), hypothesis (property-based).
  • Framework under test — Django / FastAPI / Flask / Starlette / pure library. Test patterns differ.

If the file does not exist, ask: Python version, framework, plugins standardized, async style, CI provider.


Why pytest

  • Declarative, scoped fixtures — composable, reusable, scoped per function / class / module / session.
  • Parametrization — boundary cases and data-driven tests are trivial.
  • Plugin ecosystem — hundreds of plugins, generally maintained.
  • Plain functions — no inheritance, no special syntax. Tests are functions.
  • Detailed assertion introspectionassert x == y shows exactly what differed, no special matcher API needed.

When not to use pytest:

  • Non-Python — see jest-vitest / junit-testng / xunit-nunit.
  • Pure black-box API testing without Python ecosystem benefits — Postman / Newman might be a better fit for QA-only teams (cross-reference postman-newman).

Test layout

src/
├── myproject/
│   ├── __init__.py
│   └── ...
tests/
├── conftest.py           # shared fixtures, hooks
├── unit/
│   ├── test_math.py
│   └── test_parsers.py
├── integration/
│   ├── conftest.py       # integration-only fixtures
│   └── test_api.py
└── fixtures/
    └── sample.json

Read the full file on GitHub · 343 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 343 lines · 129 tokens per session scan A 9f8164d10889

Subscribe to this mod's changes

pytest is a skill published in the GitHub repository aks-builds/quality-skills (2 stars, last pushed 4d ago), licensed MIT. It adds 129 tokens to every session and 2,791 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

incremental-python-programmer

Takes a Python repository and natural language feature description as input, implements the feature with proper code placement, generates comprehensive tests, and ensures all tests pass. Use when Claude needs to: (1) Add new features to existing Python projects, (2) Implement functions, classes, or modules based on…

ArabelaTso/Skills-4-SE · 110 tokens

python-regression-test-generator

Automatically generates regression tests for Python codebases by analyzing changes between old and new code versions and their existing tests. Migrates tests to work with new code, generates tests for new functionality, and creates mocks for external dependencies. Supports unittest and pytest frameworks. Use when…

ArabelaTso/Skills-4-SE · 70 tokens

directed-test-input-generator

Generate targeted test inputs to reach specific code paths and hard-to-reach behaviors in Python code. Use when: (1) Targeting uncovered branches or specific execution paths, (2) Need coverage-guided test generation, (3) Want to leverage LLM understanding of code semantics for meaningful test inputs, (4) Testing…

ArabelaTso/Skills-4-SE · 112 tokens

python-test-updater

Updates Python test code to work with new versions of the code being tested. Use when Claude needs to: (1) Update tests after code changes, (2) Fix broken tests due to signature changes, (3) Update assertions to match new behavior, (4) Add test cases for new functionality, (5) Analyze code differences and their test…

ArabelaTso/Skills-4-SE · 109 tokens

integration-test-generator

Generate integration tests for multiple interacting components in Python. Use when testing interactions between: (1) Multiple services or APIs (REST/GraphQL endpoints, microservices), (2) Database operations with repositories/ORMs (SQLAlchemy, Django ORM), (3) External services (payment gateways, email services…

ArabelaTso/Skills-4-SE · 113 tokens

tlaplus-spec-generator

Automatically generate TLA+ specifications from source code (C/C++, Python) for formal verification of distributed systems. Use when users need to: (1) Generate TLA+ specs from program implementations, (2) Model distributed systems, consensus protocols, or concurrent algorithms, (3) Extract state variables, actions…

ArabelaTso/Skills-4-SE · 118 tokens