python-testing

Generate pytest unit tests with fixtures, mocking, and parametrization.

6|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/DmitriyYukhanov/claude-plugins --skill python-testing-dmitriyyukhanov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/DmitriyYukhanov/claude-plugins/tree/main/plugins/python-dev/skills/python-testing
Command: npx skills add https://github.com/DmitriyYukhanov/claude-plugins --skill python-testing-dmitriyyukhanov

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and patterns for writing robust and effective tests for Python applications, ensuring code quality and reliability.

Core Features & Use Cases

  • Pytest Integration: Detects and leverages pytest for testing.
  • Test Distribution: Recommends optimal distribution between unit, integration, and E2E tests.
  • Pattern Library: Offers examples for unit tests (Arrange-Act-Assert, parametrization), async testing, integration tests (DB, API), and conftest usage.
  • Coverage Guidance: Provides best practices for test coverage.

Quick Start

Use the python-testing skill to generate a pytest unit test for the calculate_total function.

Frequently Asked Questions about python-testing

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

FAQPage Schema
How do I write parametrized unit tests in pytest?

Shared fixtures in pytest are defined in a conftest.py file. This file automatically provides reusable test data and setup logic across multiple test modules without needing explicit imports, streamlining integration and unit test management.

What is the best way to structure integration tests for databases and APIs?

The best way to structure integration tests for databases and APIs is to balance them with unit tests. Using pytest fixtures to manage database transactions and mock external API calls ensures your integration tests remain isolated, reliable, and maintainable.

How do I test asynchronous Python code with pytest?

Testing asynchronous Python code with pytest involves using async-compatible fixtures and test marks. You can define async test functions to directly await coroutines, validating database connections and API endpoints without blocking the event loop.

How do I use mocking in pytest to isolate unit tests?

Mocking in pytest isolates unit tests by replacing external dependencies with simulated objects. You can patch functions or classes during test execution to verify specific interactions and return values without triggering real database or API calls.

Does pytest work well for both unit and integration testing?

Pytest works well for both unit and integration testing by leveraging fixtures and conftest.py. It provides structured testing approaches that ensure code quality across different test distribution layers, from isolated functions to full API and database integration.