python-testing

Standardize Python test suites with pytest and unittest fixtures, parameterization, and mocks.

1|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/caraya/agent-skills --skill python-testing-caraya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/caraya/agent-skills/tree/main/skills/python-testing
Command: npx skills add https://github.com/caraya/agent-skills --skill python-testing-caraya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python testing with consistent patterns for pytest and unittest, fixture design, and coverage validation to reduce flaky tests and improve maintainability.

Core Features & Use Cases

  • Descriptive test names and independent tests
  • Appropriate fixture scopes to avoid pollution
  • Parameterize repetitive checks
  • Mock external dependencies and assert calls precisely

Quick Start

Run a pytest-based test suite to validate fixtures, parameterization, and coverage across your project.

Frequently Asked Questions about python-testing

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

FAQPage Schema
How do I standardize pytest fixtures and parameterization to reduce flaky tests?

Standardize pytest fixtures and parameterization by applying appropriate fixture scopes to avoid state pollution and parameterizing repetitive checks, ensuring test isolation and repeatable results across your suite.

What is the best way to mock external dependencies in Python tests?

Mock external dependencies in Python tests by isolating components and asserting calls precisely, ensuring deterministic structure and reliable test execution without relying on external services.

Can I use this approach with both pytest and unittest frameworks?

Yes, this testing standardization approach supports both pytest and unittest frameworks, enforcing descriptive test naming and deterministic structure to improve reliability across different Python testing environments.

How do I validate test coverage using pytest-cov and coverage.py?

Validate test coverage using pytest-cov and coverage.py by running your pytest-based test suite, enforcing compatibility with coverage tools to ensure comprehensive validation across your project.

Why do my Python tests fail due to fixture state pollution between runs?

Python tests fail from fixture state pollution when scopes are inappropriate; applying correct fixture scopes ensures isolation and prevents data leakage, yielding deterministic and repeatable test results.