python-testing
/python-testing
Test Python services with pytest, async coverage, monkeypatch, and boundary-focused fakes. Use when writing Python tests, fixtures, async tests, regression tests, or dependency-isolated verification.
- Author
- HoangNguyen0403 ↗
- Repository
- agent-skills-standard ↗
- Licence
- MIT
- Last repository change
- 22.10.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Test Python services with pytest, async coverage, monkeypatch, and boundary-focused fakes. Use when writing Python tests, fixtures, async tests, regression tests, or dependency-isolated verification.
Original author description
Test Python services with pytest, async coverage, monkeypatch, and boundary-focused fakes. Use when writing Python tests, fixtures, async tests, regression tests, or dependency-isolated verification.
How it works
- Priority: P0 (CRITICAL)
- Core Rule Anchors
- Rules
- Recipe
- Anti-Patterns
- References
SKILL.md preview
---
name: python-testing
description: Test Python services with pytest, async coverage, monkeypatch, and boundary-focused fakes. Use when writing Python tests, fixtures, async tests, regression tests, or dependency-isolated verification.
metadata:
triggers:
files:
- "tests/**/*.py"
- "pytest.ini"
- "**/conftest.py"
- "**/test_*.py"
- "**/*_test.py"
keywords:
- pytest
- monkeypatch
- fixture
- async test
- regression test
---
# Python Testing
## **Priority: P0 (CRITICAL)**
## Core Rule Anchors
- **`[BE-TEST-01]` Parametrized Tests for Equivalent Inputs**: Prefer `pytest.mark.parametrize` for equivalent inputs and boundary permutations. Distinct scenarios may stay separate.
- **`[BE-TEST-02]` Ban on Brittle SQL String Matching**: Test pure domain calculations directly or use fakes/testcontainers; do not regex-match SQL strings in mocks.
- **`[BE-TEST-03]` Ban on Shallow Assertions**: Never assert only `assert result` without inspecting domain attributes and invariants.
- **`[BE-TEST-04]` Ban on Pass-Through Seam Mocks**: Repositories and adapters must test contract compliance and error mapping; ban 1:1 pass-through mock echoing.
- **`[BE-TEST-05]` Bug-First Regression Lock**: Every PR fixing a bug ticket or with title `fix(...)` must introduce a failing test reproducing the defect before fixing it.
## Rules
- Use `pytest` and `pytest-asyncio` for async boundaries.
- Add regression tests around contract parsing, workflow routing, and verifier outcomes (`[BE-TEST-05]`).
- Prefer `pytest.mark.parametrize` for equivalent inputs; distinct scenarios may stay separate (`[BE-TEST-01]`).
- Prefer fakes or monkeypatch at external seams: DB, RPC, Telegram, subprocess, Docker (`[BE-TEST-02]`, `[BE-TEST-04]`).
- Verify behavior and domain invariants, not shallow truthiness or implementation trivia (`[BE-TEST-03]`).
- Coverage is diagnostic and project-configured; verify risk-weighted critical paths rather than padding code for an arbitrary percentage.
## Recipe
1. **Write the failing test first** for the boundary or regression (`[BE-TEST-05]`).
2. **Patch one seam high enough** to keep the test readable (`[BE-TEST-04]`).
3. **Assert structured outcomes**: metadata, route result, blocker text, emitted command (`[BE-TEST-03]`).
4. **Use async tests for async code**; avoid spinning real event loops manually.
5. **Cover negative paths** for malformed packets, stale runtime state, and missing env.
## Anti-Patterns
- **`[BE-TEST-01]` Stylistic parametrize rewrites**: Do not demand parameterized rewrites of passing tests without a behavioral gap.
- **`[BE-TEST-02]` SQL regex matching**: Do not regex-match SQL strings in mocks.
- **`[BE-TEST-03]` Shallow assertions**: Never assert only `assert result`; always verify domain attributes and invariants.
- **`[BE-TEST-04]` Pass-through seam mocks**: Ban 1:1 mock echoing without contract assertions.
- **`[BE-TEST-05]` Bug fix without reproduction test**: Ban bug fixes without a reproduction test.
- **No live network or DB in unit tests**: Use fakes or testcontainers.
- **No broad monkeypatch spray**: Patch the boundary, not every helper under it.
- **No smoke-only proof for shared runtime changes**: Add focused assertions too.
## References
- [Framework Map](../references/framework-map.md)
- [Pytest Patterns](references/pytest-patterns.md)
Files in this package (3)
- SKILL.md 3 KB
- evals/evals.json 1 KB
- references/pytest-patterns.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · HoangNguyen0403/agent-skills-standard | 90 | MIT |
| microsoft/agent-framework | 100 | MIT |
| Sanit-mann/The-Insectoids | 100 | MIT |
| jelvodev/yaap | 100 | MIT |
| aeondave/malskill | 100 | MIT |
| sophophilix/agent-skills | 100 | MIT |
| laurigates/claude-plugins | 100 | MIT |
| dmitriyyukhanov/agent-plugins | 100 | MIT |
| affaan-m/ECC | 100 | MIT |
Database snapshot: 13.11.2026 · package version 6af3dccace37 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100testing-python
Write and evaluate effective Python tests using pytest. Use when writing tests, reviewing test code, debugging test failures, or improving test coverage. Covers test design, fixtures, parameterization, mocking, and async testing. - 95pytest-testing
pytest testing patterns for any Python project: test structure, fixtures, parametrize, conftest.py, monkeypatch, tmp_path, markers, unittest.mock (MagicMock, patch), pytest-cov coverage, and best practices. Stack-agnostic — referenced by every Python plugin in the marketplace.… - 95clean-pytest
Write clean, maintainable pytest tests using Fake-based testing, contract testing, and dependency injection patterns. Use when setting up test suites for Python/MCP projects, creating Fakes for external dependencies, writing contract tests, or implementing test patterns with… - 90python-testing-patterns
Comprehensive pytest patterns for Python 3.14 / FastAPI — fixtures, parametrize, mocking, async testing, database fixtures, test markers, coverage config, and CI integration. Use when writing or structuring Python test suites beyond the basic TDD cycle. - 100testing-python
Write and evaluate effective Python tests using pytest. Use when writing tests, reviewing test code, debugging test failures, or improving test coverage. Covers test design, fixtures, parameterization, mocking, async testing, and CI integration. - 100python-dev
Expert knowledge for Python development. Includes uv, ruff, pytest, type hints, and test doubles (dependency injection, freezegun, monkeypatch). Use when writing, testing, or building Python code.