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.
git clone --depth 1 https://github.com/TechNickAI/claude_telemetryWrote 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/rules/technickai/claude_telemetry/pytest-what-to-test-and-mocking)<a href="https://agentmods.dev/rules/technickai/claude_telemetry/pytest-what-to-test-and-mocking"><img src="https://agentmods.dev/badge/rules/technickai/claude_telemetry/pytest-what-to-test-and-mocking.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.1 | $0.00003 | $0.01047 |
| Opus 5 | $0.00002 | $0.00524 |
| Sonnet 5 | $0.00001 | $0.00209 |
| Haiku 4.5 | $0.00000 | $0.00105 |
Grade A, and why
pytest-what-to-test-and-mocking 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 8d 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("requests.get", return_value=mock_response) Copies of this mod
1 near-identical copy found in the catalogue:
- pytest-what-to-test-and-mocking — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Pytest: What to Test and Mocking
Core Requirements
We mock external API calls (mark live tests with @pytest.mark.flaky()). We reuse
fixtures from conftest.py. We always use pytest as testing framework - never import
unittest. We use pytest-mock (mocker fixture) and monkeypatch for mocking, not
unittest.mock.
What to Test
Test your business logic, not the libraries you depend on.
Test Your Business Logic
def test_calculates_discount_correctly():
"""Test our custom discount calculation"""
order = Order(subtotal=Decimal("100.00"))
discount = calculate_discount(order, coupon_code="SAVE20")
assert discount == Decimal("20.00")
def test_handles_invalid_coupon_gracefully():
"""Test our error handling for invalid coupons"""
order = Order(subtotal=Decimal("100.00"))
discount = calculate_discount(order, coupon_code="INVALID")
assert discount == Decimal("0.00")
def test_order_state_transitions():
"""Test our state machine logic"""
order = Order(status="pending")
order.mark_paid()
assert order.status == "paid"
assert order.paid_at is not None
Test Integration Points
def test_sends_correct_parameters_to_stripe(mocker):
"""Test how we call Stripe API"""
mock_stripe = mocker.patch("stripe.Charge.create")
process_payment(order_id="123", amount=Decimal("50.00"))
mock_stripe.assert_called_once_with(
amount=5000, # cents
currency="usd",
source="tok_visa"
)
def test_processes_stripe_response_correctly():
"""Test how we transform Stripe data"""
stripe_response = {"id": "ch_123", "status": "succeeded"}
payment = Payment.from_stripe_response(stripe_response)
assert payment.external_id == "ch_123"
assert payment.status == "completed"
Skip Library Testing
We don't test that Pydantic validates, Django filters work, or httpx makes requests. These libraries test themselves. We focus on our logic that uses these tools.
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.
- 8d ago First seen · 136 lines · 3 tokens per session scan A 691f7154c5e2
pytest-what-to-test-and-mocking is a cursor rule published in the GitHub repository TechNickAI/claude_telemetry (31 stars, last pushed 10mo ago), licensed MIT. It adds 3 tokens to every session and 1,047 once invoked, about $0.0000 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-08-30.
Other cursor rules, from other repositories
pytest
You are an expert in pytest testing. Follow these rules.
python-cursorrules-prompt-file-best-practices
Cursor rules for Python development with best practices integration.
pytest
This guide defines our team's definitive best practices for writing fast, reliable, and maintainable tests using pytest, ensuring consistency and high code quality across projects.
python-general-coding-standards
A set of general standards for Python projects, including type hints, input checking, code style, security, web requests, background work, and tests. It also covers FastAPI-specific tasks such as CORS and authentication.
python-tests
Tests and coverage when changing src/, scripts/, or tests/.
hatch3r-python-patterns
Python 3.12+ conventions covering uv project management, Ruff lint+format, mypy strict typing, pytest parametrize, and the FastAPI/Django request-path + ORM N+1 floor.