ludo-technologies/python-best-practices/testing
Claude Code and agent skill by ludo-technologies/python-best-practices
- community
Checking that the SKILL.md file is still in the repository.
Python test-writing best practices covering test structure, fixtures, parametrization, and mocking with pytest. Use when writing, reviewing, or refactoring tests, adding test coverage, or working in tests directories and conftest.py.
Install
npx vskill@latest install ludo-technologies/python-best-practices/testingSKILL.md
Python Testing
A collection of test-writing best practices for pytest. Designed for AI agents and LLMs to write readable, maintainable, and trustworthy tests.
Categories
Mocking [CRITICAL]
Mock external boundaries only, and keep mocks faithful to real interfaces.
| Rule | Description | |
|---|---|---|
| mock-boundaries | Mock external boundaries, not internal logic | |
| mock-autospec | Use autospec to keep mocks faithful to real signatures | |
| mock-monkeypatch | Use monkeypatch for env vars and attributes |
Test Structure [HIGH]
Structure tests so failures are easy to diagnose.
| Rule | Description | |
|---|---|---|
| struct-aaa-pattern | Structure tests as Arrange-Act-Assert | |
| struct-test-naming | Name tests after the behavior they verify | |
| struct-one-behavior | Test one behavior per test | |
| struct-no-logic | Keep conditionals and loops out of tests |
Fixtures [HIGH]
Share setup without hiding it.
| Rule | Description | |
|---|---|---|
| fixture-scope | Use the narrowest fixture scope that works | |
| fixture-conftest | Place fixtures in the nearest conftest.py | |
| fixture-factory | Use factory fixtures for varied test data |
Parametrization [MEDIUM]
Eliminate duplicated tests without hiding cases.
| Rule | Description | |
|---|---|---|
| param-parametrize | Replace duplicated tests with parametrize | |
| param-ids | Give parametrized cases readable ids |
Quick Reference
Structure Patterns
Fixture Patterns
Parametrize Patterns
Mocking Patterns
See Also
- tooling / test-pytest - pytest configuration, fixtures setup, and coverage
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/testing/SKILL.md
Popularity
- Repository stars
- 24
- Repository forks
- 5
- 7-day trend score
- 16
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ludo-technologies/python-best-practices/testing)