python-testing

python-testing is a skill for Claude Code, Codex from tedivm/robs_awesome_python_template. It costs 64 tokens per session (900 once invoked), scanned A, original, MIT.

A set of instructions for writing Python tests, especially with pytest, a popular Python testing framework. It covers fixtures, FastAPI routes, databases, and project testing conventions.

In plain words
What is it for?
Use it to add tests for Python modules, web routes, database behavior, fixtures, and other application code while following pytest conventions.
Why use it?
It helps new tests match the codebase's existing structure and avoids unsuitable patterns such as unnecessary mocks or misplaced fixtures. It is for creating or changing tests, not merely running them.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to add tests for Python modules, web routes, database behavior, fixtures, and other application code while following pytest conventions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tedivm/robs_awesome_python_template/python-testing
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 tedivm/robs_awesome_python_template --skill python-testing
Clone the repo
git clone --depth 1 https://github.com/tedivm/robs_awesome_python_template

Made for: Claude Code, Codex.

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 python-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/tedivm/robs_awesome_python_template/python-testing/github.svg)](https://agentmods.dev/skills/tedivm/robs_awesome_python_template/python-testing)
Your own site
<a href="https://agentmods.dev/skills/tedivm/robs_awesome_python_template/python-testing"><img src="https://agentmods.dev/badge/skills/tedivm/robs_awesome_python_template/python-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/tedivm/robs_awesome_python_template/python-testing"><img src="https://agentmods.dev/badge/skills/tedivm/robs_awesome_python_template/python-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 900 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00064 $0.00900
Opus 5.5 $0.00026 $0.00360
Sonnet 5.5 $0.00013 $0.00180
Haiku 4.5 $0.00006 $0.00090

Measured 1mo ago against content hash 1c2b297cab7a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-testing 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 1mo 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.

{{cookiecutter.__package_slug}}/.agents/skills/python-testing/SKILL.md · 122 lines

How it starts

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

Python Testing

context7: If the context7_query-docs tool is available, resolve and load the full pytest documentation before creating new tests or running pytest commands not in the makefile:

context7_resolve-library-id: "pytest"
context7_query-docs: /pytest-dev/pytest "<query>"

Guidelines and patterns for writing tests in this codebase.


General Rules

  • No test classes unless there is a specific technical reason. Prefer standalone functions.
  • All fixtures must be defined or imported in conftest.py so they are automatically available to all tests in that directory.
  • No mocks for simple dataclasses or Pydantic models — construct an instance directly with the desired parameters instead.
  • Test file structure mirrors the main code — a test for {{cookiecutter.__package_slug}}/foo.py lives at tests/test_foo.py.
  • When adding new code, add tests to cover it.

Running Tests

make pytest              # Run full test suite with coverage report
make pytest_loud         # Run with debug logging enabled
uv run pytest            # Run directly — append any pytest options/arguments
uv run pytest tests/test_foo.py -k test_my_function -s

{%- if cookiecutter.include_fastapi == "y" %}

FastAPI Tests

Use the FastAPI TestClient via a fixture rather than calling router classes directly.

import pytest
from fastapi.testclient import TestClient
from {{cookiecutter.__package_slug}}.www import app


@pytest.fixture
def client() -> TestClient:
    return TestClient(app)


def test_get_health(client: TestClient) -> None:
    response = client.get("/health")
    assert response.status_code == 200

{%- endif %}

{%- if cookiecutter.include_sqlalchemy == "y" %}

Database Tests

Use a memory-backed SQLite fixture. Wire it into the FastAPI app via a dependency override so routes use the test database automatically.

import pytest_asyncio
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine, async_sessionmaker
from {{cookiecutter.__package_slug}}.models.base import Base


@pytest_asyncio.fixture
async def db_session() -> AsyncSession:
    engine = create_async_engine("sqlite+aiosqlite:///:memory:")
    async with engine.begin() as conn:
        await conn.run_sync(Base.metadata.create_all)

    async_session = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
    async with async_session() as session:
        yield session

    await engine.dispose()

Read the full file on GitHub · 122 lines

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. 1mo ago First seen · 122 lines · 64 tokens per session scan A 1c2b297cab7a

Subscribe to this mod's changes

python-testing is a skill published in the GitHub repository tedivm/robs_awesome_python_template (312 stars, last pushed 5mo ago), licensed MIT. It adds 64 tokens to every session and 900 once invoked, about $0.0003 per session on Opus 5.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-30.

Related

Other skills, from other repositories

pytest-suite

Write or extend the backend test suite following this project's conventions. Use when adding tests for a new service/route/repository, when coverage is missing, or when asked to test a feature. Knows the mocked-session + httpx AsyncClient setup so tests run with no database.

vstorm-co/full-stack-ai-agent-template · 59 tokens

pytest

Advanced Python unit testing framework for customer support tech enablement, covering FastAPI, SQLAlchemy, PostgreSQL, async operations, mocking, fixtures, parametrization, coverage, and comprehensive testing strategies for backend support systems.

manutej/luxor-claude-marketplace · 44 tokens

unit-test

Testing patterns for the Python/FastAPI + React/TypeScript stack. Covers pytest configuration, conftest fixtures, database safety guards, external API mocking, async tests, Celery eager mode, and Vitest for frontend.

LuuOW/meridian-mcp · 57 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

python-testing

Guidelines for writing and running tests in the Agent Framework Python codebase. Use this when creating, modifying, or running tests.

microsoft/agent-framework · 29 tokens

adk-verify-snippets

Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail report with per-snippet coverage. Use when the user asks to verify, test, or validate the code samples in a README, a guide…

google/adk-python · 149 tokens