pytest-skill

pytest-skill is a skill for Claude Code, Codex from LambdaTest/agent-skills. It costs 77 tokens per session (1,285 once invoked), scanned A, original, MIT.

A Python testing workflow for pytest, a tool that runs automated checks on Python code. It covers reusable test setup, repeated test cases, test labels, mocks, and shared configuration.

In plain words
What is it for?
It is for creating pytest tests with fixtures, parameterized inputs, markers, mocks, and conftest.py files.
Why use it?
It reduces the work of writing consistent tests and organizing setup and cleanup across a Python project.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

not rated 401repo +2 16d ago A scan Socket: passSnyk: passSkillSpector: pass 77 tokens original MIT

Good fit It is for creating pytest tests with fixtures, parameterized inputs, markers, mocks, and conftest.py files.

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

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 pytest-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/lambdatest/agent-skills/pytest-skill/github.svg)](https://agentmods.dev/skills/lambdatest/agent-skills/pytest-skill)
Your own site
<a href="https://agentmods.dev/skills/lambdatest/agent-skills/pytest-skill"><img src="https://agentmods.dev/badge/skills/lambdatest/agent-skills/pytest-skill/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 pytest-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/lambdatest/agent-skills/pytest-skill"><img src="https://agentmods.dev/badge/skills/lambdatest/agent-skills/pytest-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,285 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
  • Socket pass 18 Mar 2026
  • Snyk pass 5 Mar 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.00077 $0.01285
Opus 5.5 $0.00031 $0.00514
Sonnet 5.5 $0.00015 $0.00257
Haiku 4.5 $0.00008 $0.00128

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

Security

Grade A, and why

pytest-skill scanned grade A with 1 finding 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 3mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

mocker.patch("myapp.service.requests.get", return_value=mock_response)
pytest-skill/SKILL.md · 196 lines

How it starts

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

Pytest Testing Skill

Core Patterns

Basic Test

import pytest

def test_addition():
    assert 2 + 3 == 5

def test_exception():
    with pytest.raises(ValueError, match="invalid"):
        int("not_a_number")

class TestCalculator:
    def test_add(self):
        calc = Calculator()
        assert calc.add(2, 3) == 5

    def test_divide_by_zero(self):
        with pytest.raises(ZeroDivisionError):
            Calculator().divide(10, 0)

Fixtures

@pytest.fixture
def calculator():
    return Calculator()

@pytest.fixture
def db_connection():
    conn = Database.connect("test_db")
    yield conn  # teardown after yield
    conn.rollback()
    conn.close()

@pytest.fixture(scope="module")
def api_client():
    client = APIClient(base_url="http://localhost:8000")
    yield client
    client.logout()

# conftest.py - shared fixtures
@pytest.fixture(autouse=True)
def reset_state():
    State.reset()
    yield
    State.cleanup()

# Usage
def test_add(calculator):
    assert calculator.add(2, 3) == 5

Parametrize

@pytest.mark.parametrize("input,expected", [
    ("hello", 5), ("", 0), ("pytest", 6),
])
def test_string_length(input, expected):
    assert len(input) == expected

@pytest.mark.parametrize("a,b,expected", [
    (2, 3, 5), (-1, 1, 0), (0, 0, 0),
])
def test_add(calculator, a, b, expected):
    assert calculator.add(a, b) == expected

Markers

@pytest.mark.slow
def test_large_dataset(): ...

@pytest.mark.skip(reason="Not implemented")
def test_future_feature(): ...

@pytest.mark.skipif(sys.platform == "win32", reason="Unix only")
def test_unix_permissions(): ...

@pytest.mark.xfail(reason="Known bug #123")
def test_known_bug(): ...

Mocking

from unittest.mock import patch, MagicMock

def test_send_email(mocker):
    mock_smtp = mocker.patch("myapp.email.smtplib.SMTP")
    send_welcome_email("[email protected]")
    mock_smtp.return_value.sendmail.assert_called_once()

def test_api_call(mocker):
    mock_response = mocker.Mock()
    mock_response.status_code = 200
    mock_response.json.return_value = {"users": [{"name": "Alice"}]}
    mocker.patch("myapp.service.requests.get", return_value=mock_response)
    users = get_users()
    assert len(users) == 1

@patch("myapp.service.database")
def test_save_user(mock_db):
    mock_db.save.return_value = True
    assert save_user({"name": "Alice"}) is True
    mock_db.save.assert_called_once()

Read the full file on GitHub · 196 lines

Files

What ships with it

2 files 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. 3mo ago First seen · 196 lines · 77 tokens per session scan A 771b4f0c803e

Subscribe to this mod's changes

pytest-skill is a skill published in the GitHub repository LambdaTest/agent-skills (401 stars, last pushed 16d ago), licensed MIT. It adds 77 tokens to every session and 1,285 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

pytest-skill compared with skills from other repositories

pytest-skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pytest-skillLambdaTest/agent-skillsSkill40116d agoMITA77Claude Code, Codex
rust-testingaffaan-m/ECCSkill316k2d agoMITA31Claude Code, Kiro
golang-testingaffaan-m/ECCSkill316k2d agoMITA37Claude Code, Kiro
java-affected-testsopen-metadata/OpenMetadataSkill16ktodayApache-2.0A120Claude Code
migrate-xunit-to-xunit-v3dotnet/skillsSkill6.4ktodayMITA149Claude Code
golang-testingsamber/cc-skills-golangSkill4.1k2d agoMITA115Claude Code
adk-setupgoogle/adk-pythonSkill23ktodayApache-2.0C146Claude Code, Codex