python-testing

Define pytest testing policies for Python projects with fixtures and coverage targets.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidelines and best practices for writing effective and maintainable tests for Python projects, ensuring code quality and reliability.

Core Features & Use Cases

  • Test Structure and Naming: Enforces clear and consistent naming conventions for test functions.
  • Fixture Management: Guides the use of pytest fixtures with appropriate scoping and cleanup.
  • Parametrization: Promotes efficient testing by parametrizing tests for various inputs.
  • Coverage Targets: Defines clear goals for test coverage.
  • Use Case: When developing a new Python feature, use this Skill to ensure your tests are well-structured, cover edge cases, and meet coverage requirements before merging.

Quick Start

Follow the pytest testing policies for Python projects.

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 tests and fixtures for a Python project?

To structure pytest tests, enforce clear naming conventions for test functions and organize files following standard project structure. Use pytest fixtures with appropriate scoping and yield for cleanup to ensure maintainable and independent test execution across your Python project.

What is the best way to parametrize pytest tests with multiple inputs?

The best way to parametrize pytest tests is using the parametrization feature with explicit IDs. This approach promotes efficient testing by clearly mapping various inputs to their expected outcomes, ensuring edge cases are covered without duplicating test function code.

How do I configure test coverage targets in pyproject.toml for pytest?

Configure test coverage targets directly in pyproject.toml to define clear goals for code quality. Setting these thresholds ensures your Python project meets reliability requirements before merging by enforcing minimum coverage percentages across the test suite.

What are common pytest anti-patterns to avoid when writing Python tests?

Common pytest anti-patterns include using time.sleep for synchronization and relying on shared mutable state across tests. Avoiding these practices ensures your tests remain independent, reliable, and aligned with TDD principles for robust Python code.

Can I use this Skill to guide TDD practices for new Python features?

Yes, you can use this Skill to guide TDD practices. It provides comprehensive guidelines to ensure your tests are well-structured, cover edge cases through parametrization, and meet defined coverage requirements before merging new Python features.