python-testing

Automate Python testing workflows with pytest and TDD conventions.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/TrollHeap/dotfiles --skill python-testing-trollheap
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/TrollHeap/dotfiles/tree/main/ai-config/.claude/templates/python-script/.claude/skills/python-testing
Command: npx skills add https://github.com/TrollHeap/dotfiles --skill python-testing-trollheap

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python testing strategies using pytest, TDD, fixtures, mocking, parametrization, and coverage targets to improve code reliability.

Core Features & Use Cases

  • TDD workflow guidance: adopt red-green-refactor cycles to drive design and ensure tests guide implementation.
  • Coverage targets: aim for 80%+ overall coverage with higher priority on critical paths.
  • Fixtures, parametrization, and mocks: reusable test data, flexible test cases, and isolation of external dependencies.

Quick Start

Run pytest with coverage to validate new tests and measure results.

Frequently Asked Questions about python-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure pytest fixtures for reusable Python test data?

Pytest fixtures provide reusable test data by defining functions that set up and tear down contexts. This Skill automates pytest fixture conventions to ensure isolated, maintainable Python test suites across your project.

What is the red-green-refactor cycle in Python TDD?

The red-green-refactor cycle in TDD involves writing a failing test, writing code to pass it, then refactoring. This Skill applies this workflow to drive module design and ensure tests guide your Python implementation.

How do I measure Python test coverage with pytest?

Measure Python test coverage by running pytest with coverage reporting tools. This Skill enforces consistent coverage targets, aiming for 80%+ overall coverage with higher priority on critical paths.

Can I use mocking to isolate external dependencies in Python testing?

Mocking isolates external dependencies by replacing them with controlled objects during Python testing. This Skill supports pytest-based mocking to ensure your tests remain reliable and independent of external systems.

What is the best way to run parameterized tests in pytest?

Parameterized tests in pytest allow running the same test logic against multiple inputs. This Skill builds flexible test cases using pytest parametrization conventions to validate Python modules thoroughly.