python-testing

Guide pytest-based Python test suites with TDD, fixtures, mocking, and coverage targets.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/romankovsv/claude-code-python-devops-mlops --skill python-testing-romankovsv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/romankovsv/claude-code-python-devops-mlops/tree/main/skills/python-testing
Command: npx skills add https://github.com/romankovsv/claude-code-python-devops-mlops --skill python-testing-romankovsv

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python projects often struggle with building reliable test suites, requiring structured guidance on TDD, fixtures, mocking, and maintaining coverage.

Core Features & Use Cases

  • TDD workflow with red-green-refactor
  • Fixtures and parametrization for robust tests
  • Mocking external dependencies and isolation
  • Coverage targets and CI-friendly reporting

Quick Start

Set up a pytest-based test suite following the TDD cycle and aim for 80%+ coverage.

Frequently Asked Questions about python-testing

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

FAQPage Schema
How do I set up a pytest test suite using TDD?

Mocking external dependencies in Python tests isolates the code under test from external systems. Use mocking techniques within your pytest suite to replace external calls, ensuring reliable and deterministic test execution without real side effects.

How do I parametrize tests in pytest for better coverage?

Parametrizing tests in pytest allows you to run the same test logic against multiple inputs. Apply pytest parametrization to generate test cases dynamically, broadening your test coverage while minimizing code duplication.

How do I enforce 80% code coverage targets in Python CI?

To enforce 80% code coverage in CI, configure your pytest execution to generate coverage reports and fail the pipeline if the threshold is unmet. Structure your test suite to validate all critical paths and maintain the target.

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

Mocking external dependencies in Python tests isolates the code under test from external systems. Use mocking techniques within your pytest suite to replace external calls, ensuring reliable and deterministic test execution without real side effects.