python-testing

Create pytest test suites with fixtures, mocking, and coverage enforcement.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill python-testing-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/python-testing
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill python-testing-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents bugs and regressions by giving you a clear, repeatable way to write fast, maintainable Python tests with pytest and coverage targets.

Core Features & Use Cases

  • Test-Driven Development (TDD) workflow: Follow the red → green → refactor cycle to drive correct implementations.
  • High-signal pytest patterns: Use fixtures (scopes, parametrization, autouse), parametrized tests, and clear assertions.
  • Production-grade confidence controls: Apply mocking/patching for external dependencies, add pytest markers for selective runs, and enforce coverage (80%+ overall, 100% on critical paths).
  • Use Case: You’re adding a new API endpoint and need confidence it behaves correctly across edge cases, with deterministic unit tests and separate integration-style coverage.

Quick Start

Ask for a pytest test plan that uses TDD, fixtures, mocking, parametrization, markers, and enforces 80%+ coverage while requiring 100% coverage on the critical path for your Python module.

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 using TDD and fixtures?

To structure pytest tests using TDD, apply the RED-GREEN-REFACTOR cycle alongside fixtures with specific scopes and parametrization. This combination drives correct implementations and isolates dependencies for maintainable test suites.

What is the best way to enforce test coverage thresholds in Python?

Enforce test coverage thresholds in Python by configuring pytest-cov to set measurable targets. Apply an 80% or higher overall coverage requirement while demanding 100% coverage specifically on critical application paths to prevent regressions.

How do I isolate external dependencies in pytest unit tests?

Isolate external dependencies in pytest unit tests by applying mocking and patching techniques. This ensures tests remain deterministic by preventing external calls from affecting the validation of core Python logic.

Can I run specific pytest test groups using markers?

Yes, you can run specific pytest test groups by applying pytest markers for selection. This allows you to selectively execute targeted test categories, isolating fast unit tests from slower integration-style workflows.

How do I validate edge cases in Python using parametrized tests?

Validate edge cases in Python by utilizing parametrized tests and parametrized fixtures to efficiently run identical test logic across multiple inputs. This high-signal pytest pattern ensures code behaves correctly across varied data scenarios.