Skip to content
Skills Library
Programming · Testing

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.

Licence
MIT
Last repository change
22.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

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

  1. Priority: P0 (CRITICAL)
  2. Core Rule Anchors
  3. Rules
  4. Recipe
  5. Anti-Patterns
  6. References
Original SKILL.md headings · 45 lines, 382 words
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

RepositoryScoreLicence
This page · HoangNguyen0403/agent-skills-standard90MIT
microsoft/agent-framework100MIT
Sanit-mann/The-Insectoids100MIT
jelvodev/yaap100MIT
aeondave/malskill100MIT
sophophilix/agent-skills100MIT
laurigates/claude-plugins100MIT
dmitriyyukhanov/agent-plugins100MIT
affaan-m/ECC100MIT

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.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.