Skip to content
Back to skills

Python Testing

ASecurity

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.

  • 584 stars
  • 0 votes
  • 1 copy
  • 5 views
  • Added September 5, 2026
developmentpythondockertesting

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 25, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill python-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-python-testing-6d04648e/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-python-testing-6d04648e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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)**

Universal anti-slop rules (identity fixtures, tautologies, skip/focus, mock echoing, bug-first lock, sleeps, shallow
assertions, coverage): [anti-slop-rules.md](../../common/common-tdd/references/anti-slop-rules.md). Only Python deltas
follow.

## Stack Deltas

- **Framework**: `pytest` with `pytest-asyncio` for async boundaries; fixtures live in `conftest.py`.
- **Isolation (`[BE-TEST-04]`)**: fake or `monkeypatch` at external seams — DB, RPC, subprocess, Docker; patch one seam
  high enough to keep the test readable; no broad monkeypatch spray.
- **Parametrize (`[BE-TEST-01]`)**: `pytest.mark.parametrize` for equivalent inputs and boundaries; distinct scenarios may
  stay separate.
- **Assertions (`[BE-TEST-03]`)**: assert structured outcomes — metadata, route result, blocker text, emitted command —
  not shallow truthiness or implementation trivia.
- **Regression (`[BE-TEST-05]`)**: cover contract parsing, workflow routing, and verifier outcomes.
- **Coverage**: diagnostic and project-configured; verify risk-weighted critical paths.

## Recipe

1. Write the failing test first for the boundary or regression.
2. Patch one seam high enough to keep the test readable.
3. Assert structured outcomes.
4. Use async tests for async code; do not spin real event loops manually.
5. Cover negative paths for malformed packets, stale runtime state, and missing env.

## Anti-Patterns

- **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.

## References

- [Framework Map](../references/framework-map.md)
- [Pytest Patterns](references/pytest-patterns.md)

Files in this skill

  • SKILL.md1.6 KB
  • evals/evals.json1.2 KB
  • references/pytest-patterns.md475 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.