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.
npx agentmods add skills/everyone-needs-a-copilot/claude-copilot/pytest-patternsnpx skills add Everyone-Needs-A-Copilot/claude-copilot --skill pytest-patternsgit clone --depth 1 https://github.com/Everyone-Needs-A-Copilot/claude-copilotWrote 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.
[](https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/pytest-patterns)<a href="https://agentmods.dev/skills/everyone-needs-a-copilot/claude-copilot/pytest-patterns"><img src="https://agentmods.dev/badge/skills/everyone-needs-a-copilot/claude-copilot/pytest-patterns.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00129 | $0.04225 |
| Opus 5 | $0.00064 | $0.02112 |
| Sonnet 5 | $0.00026 | $0.00845 |
| Haiku 4.5 | $0.00013 | $0.00422 |
Grade A, and why
pytest-patterns 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 today.
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.
mock_get = mocker.patch("requests.get") How it starts
The opening of the file, as written. The whole thing — 470 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Pytest Patterns
Modern pytest testing patterns, anti-patterns, and quality rules for Python.
pytest_smell.py detects structural test smells deterministically. The prose sections below cover judgment-level guidance that the script cannot evaluate. Never re-derive smell detection by eye when the script can do it; always run the script for consistent, auditable findings.
Core Principles
| Principle | Description |
|---|---|
| Fixtures over setup | Use fixtures for test dependencies |
| Parametrize | Test multiple cases without duplication |
| Explicit is better | Clear test names and assertions |
| Fast isolation | Each test runs independently |
Patterns vs Anti-Patterns
Fixtures
# GOOD: Fixtures for test dependencies
@pytest.fixture
def db_session():
"""Provide a clean database session."""
session = create_session()
yield session
session.rollback()
session.close()
@pytest.fixture
def sample_user(db_session):
"""Create a sample user for tests."""
user = User(name="John", email="[email protected]")
db_session.add(user)
db_session.commit()
return user
def test_get_user(db_session, sample_user):
result = get_user_by_id(db_session, sample_user.id)
assert result.name == "John"
# BAD: Setup in each test
def test_get_user():
session = create_session()
user = User(name="John", email="[email protected]")
session.add(user)
session.commit()
# ... test code
session.rollback() # Easy to forget cleanup!
Fixture Scopes
# GOOD: Appropriate fixture scopes
@pytest.fixture(scope="session")
def docker_db():
"""Start database container once per test session."""
container = start_postgres_container()
yield container
container.stop()
@pytest.fixture(scope="module")
def api_client():
"""Create API client once per test module."""
return APIClient(base_url="http://test.local")
@pytest.fixture # Default: function scope
def clean_data(db_session):
"""Fresh data for each test."""
yield
db_session.query(User).delete()
# BAD: Wrong scope causes test pollution
@pytest.fixture(scope="session") # DANGER!
def user():
return User(name="John") # Shared across all tests!
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.
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.
- today First seen · 470 lines · 129 tokens per session scan A 85e10117406a
pytest-patterns is a skill published in the GitHub repository Everyone-Needs-A-Copilot/claude-copilot (13 stars, last pushed 10d ago), licensed MIT. It adds 129 tokens to every session and 4,225 once invoked, about $0.0006 per session on Opus 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-09-04.
Other skills, from other repositories
pytest
Skill "pytest" from bobmatnyc/claude-mpm-skills, covering pytest - professional python testing, basic pytest, with common plugins, for fastapi testing and for django testing.
pytest
Skill "pytest" from bobmatnyc/claude-mpm, covering pytest - professional python testing, basic pytest, with common plugins, for fastapi testing and for django testing.
pytest-testing
Write maintainable pytest suites — fixtures and scopes, parametrize, tmppath, monkeypatch, coverage, and a CI-friendly layout.
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.
pytest-expert
Pytest fixtures, parametrize, mock/monkeypatch, async testing with pytest-asyncio, and coverage reporting.
test-generator
Generate pytest test cases for Python functions and classes.