python-testing

Provide structured pytest patterns for fixtures, parametrization, mocking, and coverage.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/joonwon-space/kis-api-ai --skill python-testing-joonwon-space
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/joonwon-space/kis-api-ai/tree/main/.claude/skills/python-testing
Command: npx skills add https://github.com/joonwon-space/kis-api-ai --skill python-testing-joonwon-space

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to Python testing, helping teams achieve reliable, maintainable test suites with consistent patterns.

Core Features & Use Cases

  • TDD guidance: Follow red-green-refactor workflows to build robust Python code.
  • Pytest patterns: Leverage fixtures, parametrization, mocking, autospec, and careful assertion strategies.
  • Use Case: Imagine a project where you need repeatable tests across modules; this Skill guides you from basic tests to advanced coverage targets and test organization.

Quick Start

Create a small Python module and write a simple pytest test, then progressively introduce fixtures and parametrized tests. Use these templates as a starting point and adapt them to your codebase.

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 for a growing Python project?

Structure pytest tests by organizing modules into dedicated test directories, leveraging reusable fixtures for setup, and applying parametrization to cover multiple inputs. This ensures maintainability and consistency as your Python test suite scales across modules.

What is the red-green-refactor workflow in test-driven development?

Test-driven development follows a red-green-refactor workflow: write a failing test first, write the minimum Python code to make it pass, then refactor the implementation while keeping tests green. This builds robust, test-backed code.

Can I reuse fixtures across different pytest test modules?

Yes, you can reuse pytest fixtures across different test modules by defining them in a conftest.py file. This allows shared setup logic to be injected into multiple tests, reducing duplication and maintaining consistent test environments.

How do I track code coverage when running pytest?

Track code coverage during pytest execution by configuring coverage reporting tools to measure executed lines. Setting coverage targets helps identify untested paths in your Python codebase and enforces testing reliability standards.

What is the best way to mock external dependencies in pytest?

The best way to mock external dependencies in pytest is using the built-in mocker fixture with autospec to ensure mock objects match actual API signatures. This prevents silent failures and validates interaction patterns in Python tests.

Does pytest parametrization work for complex data structures?

Yes, pytest parametrization works effectively for complex data structures by allowing you to pass multiple argument sets to a single test function. This generates distinct test cases dynamically, ensuring comprehensive input coverage without duplicating test code.