python-testing-patterns
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.
Skill by leeno7786-coder
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/leeno7786-coder-python-testing-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
python-testing-patterns- Description
- Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
- License
- MIT
- Instructions
- 275 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (3)
- SKILL.md
- advanced-patterns.md · references/
- details.md · references/
SKILL.md (first lines)
# Python Testing Patterns
Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices.
## When to Use This Skill
- Writing unit tests for Python code
- Setting up test suites and test infrastructure
- Implementing test-driven development (TDD)
- Creating integration tests for APIs and services
- Mocking external dependencies and services
- Testing async code and concurrent operations
- Setting up continuous testing in CI/CD
- Implementing property-based testing
- Testing database operations
- Debugging failing tests
## Core Concepts
### 1. Test Types
- **Unit Tests**: Test individual functions/classes in isolation
- **Integration Tests**: Test interaction between components
- **Functional Tests**: Test complete features end-to-end
- **Performance Tests**: Measure speed and resource usage
### 2. Test Structure (AAA Pattern)
- **Arrange**: Set up test data and preconditions
- **Act**: Execute the code under test
- **Assert**: Verify the results
### 3. Test Coverage
- Measure what code is exercised by tests
- Identify untested code paths
- Aim for meaningful coverage, not just high percentages
### 4. Test Isolation
- Tests should be independent
- No shared state between tests
- Each test should clean up after itself
## Quick Start
```python
# test_example.py
def add(a, b):
return a + b
def test_add():
"""Basic test example."""
result = add(2, 3)
assert result == 5
def test_add_negative():
"""Test with negative numbers."""
assert add(-1, 1) == 0
# Run with: pytest test_example.py
```
## Detailed patterns and worked examples
Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
## Testing Best Practices
### Test Organization
```python
# tests/
# __init__.py
# conftest.py # Shared fixtures
# test_unit/ # Unit tests
# test_models.py
# test_utils.py
# test_integration/ # Integration tests
# test_api.py
# test_database.py
# test_e2e/ # End-to-end tests
# test_workflows.py
```
### Test Naming Convention
A common pattern: `test_<unit>_<scenario>_<expected_outcome>`. Adapt to your team's preferences.
```python
# Pattern: test_<unit>_<scenario>_<expected>
def test_create_user_with_valid_data_returns_user():
...
def test_create_user_with_duplicate_email_raises_conflict():
...
def test_get_user_with_unknown_id_returns_none():
...
# Good test names - clear and descriptive
def test_user_creation_with_valid_data():
"""Clear name describes what is being tested."""
pass
def test_login_fails_with_invalid_password():
"""Name describes expected behavior."""
pass
def test_api_returns_404_for_missing_resource():
"""Specific about inputs and expected outcomes."""
pass
# Bad test names - avoid these
def test_1(): # Not descriptive
pass
def test_user(): # Too vague
passFrom leeno7786-coder/nanoagent, MIT.
More from leeno7786-coder/nanoagent
- 0.614score
github-actions-docs
leeno7786-coder
Use when users ask how to write, explain, customize, migrate, secure, or troubleshoot GitHub Actions workflows, workflow syntax, triggers, matrices, runners…
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
react-state-management
leeno7786-coder
Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
nextjs-app-router-patterns
leeno7786-coder
Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching.
SkillAFreshness: A★ 4Claude Code +9 - 0.589score
mcp-builder
leeno7786-coder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools.
SkillAFreshness: A★ 4Claude Code +9 - 0.589score
skill-creator
leeno7786-coder
Create new skills, modify and improve existing skills, and measure skill performance.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
pdf
leeno7786-coder
Use this skill whenever the user wants to do anything with PDF files.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
brand-guidelines
leeno7786-coder
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
canvas-design
leeno7786-coder
Create beautiful visual art in .png and .pdf documents using design philosophy.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
algorithmic-art
leeno7786-coder
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
doc-coauthoring
leeno7786-coder
Guide users through a structured workflow for co-authoring documentation.
SkillAFreshness: A★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 19, 2026 (4 months ago)
- Last release
- Oct 8, 2026 (21 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/leeno7786-coder/nanoagent
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.545score
python-testing-patterns
onfire7777
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.
SkillCFreshness: C★ 16Claude Code +9 - 0.309score
python-testing-patterns
laurentvv
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.
SkillBFreshness: BClaude Code +9 - 0.264score
python-testing-patterns
jh941213
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.
SkillDFreshness: D★ 4Claude Code +9
More from leeno7786-coder
- 0.614score
github-actions-docs
leeno7786-coder
Use when users ask how to write, explain, customize, migrate, secure, or troubleshoot GitHub Actions workflows, workflow syntax, triggers, matrices, runners…
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
react-state-management
leeno7786-coder
Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.
SkillAFreshness: A★ 4Claude Code +9 - 0.614score
nextjs-app-router-patterns
leeno7786-coder
Master Next.js 14+ App Router with Server Components, streaming, parallel routes, and advanced data fetching.
SkillAFreshness: A★ 4Claude Code +9 - 0.589score
mcp-builder
leeno7786-coder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools.
SkillAFreshness: A★ 4Claude Code +9 - 0.589score
skill-creator
leeno7786-coder
Create new skills, modify and improve existing skills, and measure skill performance.
SkillAFreshness: A★ 4Claude Code +9 - 0.584score
pdf
leeno7786-coder
Use this skill whenever the user wants to do anything with PDF files.
SkillAFreshness: A★ 4Claude Code +9
Cite this page
python-testing-patterns skill. Agent Mart. https://agentmart.dev/skills/leeno7786-coder-python-testing-patterns (last updated 2026-10-24)