python-testing

Prefer fakes over mocks for Python unit, integration, and end-to-end tests.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/jjjermiah/dot-agents --skill python-testing-jjjermiah
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/jjjermiah/dot-agents/tree/main/src/dot-agents/skills/python-testing
Command: npx skills add https://github.com/jjjermiah/dot-agents --skill python-testing-jjjermiah

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps teams write tests that prefer fakes over mocks, enabling reliable, maintainable behavior verification without coupling tests to implementation.

Core Features & Use Cases

  • Prefer fake-based tests for business logic to ensure test stability across refactors.
  • Use mocks only for integration points or external boundaries where interaction verification is required.
  • Follow a structured five-layer testing strategy with clear guidance on where each type of test belongs.
  • Leverage fixture patterns and test-doubles guidance from references to improve test quality.

Quick Start

Use this skill to guide writing tests that rely on in-memory fakes instead of mocks.

Frequently Asked Questions about python-testing

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

FAQPage Schema
What is the difference between fakes and mocks in pytest testing?

Fakes are in-memory simulators that validate business behavior without coupling to implementation, while mocks verify interaction at external boundaries. This skill guides you to prefer fakes for stable unit tests and use mocks only for integration points.

How do I write unit tests with fakes instead of mocks in Python?

To write unit tests with fakes, replace real I/O dependencies with in-memory simulators that replicate behavior. This skill applies fixture patterns and test-doubles guidance to build maintainable fake-driven tests that survive refactoring.

Can I use pytest fixtures for integration and end-to-end tests?

Yes, pytest fixtures support unit, integration, and end-to-end tests. This skill applies a five-layer testing strategy with fixture patterns to ensure business logic is validated via in-memory simulators across all test layers.

When should I use mocks over fakes in Python testing?

Use mocks only for integration points or external boundaries where interaction verification is required. Fakes should be preferred for business logic validation to ensure test stability and maintainable behavior verification across refactors.

What testing patterns help avoid anti-patterns in pytest?

Following a structured five-layer testing strategy with proper fixture patterns and test-doubles guidance helps avoid anti-patterns. This skill ensures maintainable, observable behavior by preferring fakes over mocks for business logic validation.

Does fake-driven testing work for end-to-end tests in Python?

Fake-driven testing applies to unit, integration, and end-to-end tests where business logic should be validated via in-memory simulators rather than real I/O. This satisfies the five-layer testing strategy for maintainable behavior verification.