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 skills add Awish021/opencode --skill pytest-testsgit clone --depth 1 https://github.com/Awish021/opencodeWrote 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/awish021/opencode/pytest-tests)<a href="https://agentmods.dev/skills/awish021/opencode/pytest-tests"><img src="https://agentmods.dev/badge/skills/awish021/opencode/pytest-tests/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.
<a href="https://agentmods.dev/skills/awish021/opencode/pytest-tests"><img src="https://agentmods.dev/badge/skills/awish021/opencode/pytest-tests.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00038 | $0.05211 |
| Opus 5.5 | $0.00015 | $0.02084 |
| Sonnet 5.5 | $0.00008 | $0.01042 |
| Haiku 4.5 | $0.00004 | $0.00521 |
Grade A, and why
python-testing-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 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.
response = requests.get(f"{self.base_url}/users/{user_id}") This is a copy
89% identical to python-testing-patterns — 156 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 911 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Python Testing Patterns
Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices.
When to Use This Skill
- Writing unit tests for Python code
- Setting up test suites and test infrastructure
- Implementing test-driven development (TDD)
- Creating integration tests for APIs and services
- Mocking external dependencies and services
- Testing async code and concurrent operations
- Setting up continuous testing in CI/CD
- Implementing property-based testing
- Testing database operations
- Debugging failing tests
Core Concepts
1. Test Types
- Unit Tests: Test individual functions/classes in isolation
- Integration Tests: Test interaction between components
- Functional Tests: Test complete features end-to-end
- Performance Tests: Measure speed and resource usage
2. Test Structure (AAA Pattern)
- Arrange: Set up test data and preconditions
- Act: Execute the code under test
- Assert: Verify the results
3. Test Coverage
- Measure what code is exercised by tests
- Identify untested code paths
- Aim for meaningful coverage, not just high percentages
4. Test Isolation
- Tests should be independent
- No shared state between tests
- Each test should clean up after itself
Quick Start
# test_example.py
def add(a, b):
return a + b
def test_add():
"""Basic test example."""
result = add(2, 3)
assert result == 5
def test_add_negative():
"""Test with negative numbers."""
assert add(-1, 1) == 0
# Run with: pytest test_example.py
Fundamental Patterns
Pattern 1: Basic pytest Tests
# test_calculator.py
import pytest
class Calculator:
"""Simple calculator for testing."""
def add(self, a: float, b: float) -> float:
return a + b
def subtract(self, a: float, b: float) -> float:
return a - b
def multiply(self, a: float, b: float) -> float:
return a * b
def divide(self, a: float, b: float) -> float:
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
def test_addition():
"""Test addition."""
calc = Calculator()
assert calc.add(2, 3) == 5
assert calc.add(-1, 1) == 0
assert calc.add(0, 0) == 0
def test_subtraction():
"""Test subtraction."""
calc = Calculator()
assert calc.subtract(5, 3) == 2
assert calc.subtract(0, 5) == -5
def test_multiplication():
"""Test multiplication."""
calc = Calculator()
assert calc.multiply(3, 4) == 12
assert calc.multiply(0, 5) == 0
def test_division():
"""Test division."""
calc = Calculator()
assert calc.divide(6, 3) == 2
assert calc.divide(5, 2) == 2.5
def test_division_by_zero():
"""Test division by zero raises error."""
calc = Calculator()
with pytest.raises(ValueError, match="Cannot divide by zero"):
calc.divide(5, 0)
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.
- 3mo ago First seen · 911 lines · 38 tokens per session scan A 0ad885ec9c28
python-testing-patterns is a skill published in the GitHub repository Awish021/opencode (11 stars, last pushed 5mo ago), licensed MIT. It adds 38 tokens to every session and 5,211 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). It is 89% identical to python-testing-patterns, differing in 156 lines, and is treated as a copy.
python-testing-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| python-testing-patternsAwish021/opencode | Skill | 11 | 5mo ago | MIT | A | 38 | Claude Code, Codex |
| cpp-testingaffaan-m/ECC | Skill | 315k | yesterday | MIT | A | 34 | Claude Code, Kiro |
| rust-testingaffaan-m/ECC | Skill | 315k | yesterday | MIT | A | 31 | Claude Code, Kiro |
| nw-fp-clojurenWave-ai/nWave | Skill | 638 | 14d ago | MIT | A | 25 | Claude Code |
| nw-fp-fsharpnWave-ai/nWave | Skill | 638 | 14d ago | MIT | A | 21 | Claude Code |
| nw-fp-haskellnWave-ai/nWave | Skill | 638 | 14d ago | MIT | A | 22 | Claude Code |
| nw-fp-kotlinnWave-ai/nWave | Skill | 638 | 14d ago | MIT | A | 21 | Claude Code |