The python-testing skill teaches developers how to implement comprehensive testing strategies for Python applications using pytest, test-driven development (TDD), fixtures, mocking, and code coverage analysis. It's designed for Python developers writing new code or designing test suites who need structured guidance on testing infrastructure and best practices. The skill solves the problem of inconsistent testing approaches by providing concrete patterns for the TDD cycle (red-green-refactor), achieving 80%+ code coverage targets, and effectively using pytest features like fixtures and parametrization.

install copies · 90 days. Times the install command was copied on this site in the last 90 days, bots filtered.
7
skills.sh installs
6.6K
GitHub stars
229.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add affaan-m/everything-claude-code --skill python-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Python Testing Patterns

Comprehensive testing strategies for Python applications using pytest, TDD methodology, and best practices.

When to Activate

  • Writing new Python code (follow TDD: red, green, refactor)
  • Designing test suites for Python projects
  • Reviewing Python test coverage
  • Setting up testing infrastructure

Core Testing Philosophy

Test-Driven Development (TDD)

Always follow the TDD cycle:

  1. RED: Write a failing test for the desired behavior
  2. GREEN: Write minimal code to make the test pass
  3. REFACTOR: Improve code while keeping tests green
# Step 1: Write failing test (RED)
def test_add_numbers():
    result = add(2, 3)
    assert result == 5

# Step 2: Write minimal implementation (GREEN)
def add(a, b):
    return a + b

# Step 3: Refactor if needed (REFACTOR)

Coverage Requirements

  • Target: 80%+ code coverage
  • Critical paths: 100% coverage required
  • Use pytest --cov to measure coverage
pytest --cov=mypackage --cov-report=term-missing --cov-report=html

pytest Fundamentals

Basic Test Structure

import pytest

Sponsors

Details

Repository
github.com/affaan-m/everything-claude-code
Categories
Testing & QA, Python

More from affaan-m/everything-claude-code

All 256
1vinvcn avatartddvinvcn/mattpocock-skills-zh-cn测试驱动开发。适用于用户想用先写测试的方式构建功能或修复缺陷、提到 “red-green-refactor”,或需要集成测试时。6.1Kskills.sh installs
2affaan-m avatarspringboot-tddaffaan-m/everything-claude-codespringboot tdd6Kskills.sh installs
3affaan-m avatardjango-tddaffaan-m/everything-claude-codedjango tdd5.9Kskills.sh installs
4openai avatarplaywright-interactiveopenai/skillsPersistent browser and Electron interaction through `js_repl` for fast iterative UI debugging.5.7Kskills.sh installs
5affaan-m avatarcpp-testingaffaan-m/everything-claude-codecpp testing5.6Kskills.sh installs
6affaan-m avatarrust-testingaffaan-m/everything-claude-coderust testing5.3Kskills.sh installs