# Python Testing

> Enforce Python testing standards (pytest, coverage, fixtures)

- Skill: `yiweiren123-arch/python-testing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add yiweiren123-arch/python-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/yiweiren123-arch/python-testing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: yiweiren123-arch (https://skillmd.com/u/yiweiren123-arch)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/yiweiren123-arch/python-testing

---


# Python Testing Skill

## Rules

1. Use **pytest** as the test framework — never `unittest`.
2. Aim for ≥90% line coverage on all new code.
3. Use `pytest.fixture` for shared setup; avoid `setUp`/`tearDown` methods.
4. Name test files `test_<module>.py` and test functions `test_<behavior>`.
5. Use `pytest.mark.parametrize` for data-driven tests.
6. Mock external dependencies with `unittest.mock.patch` — never hit real APIs in tests.

