Pytest Test Data Factories
This skill teaches patterns for building maintainable test data in pytest through factory functions, builder patterns, and fixture factories. Learn to eliminate test data duplication by providing sensible defaults and easy customization for domain objects, complex structures, and parameterized datasets.
Pytest Test Data Factories helps you build reusable test data generators with fixtures and builder patterns.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-01-26
Pytest Test Data Factories helps you build reusable test data generators with fixtures and builder patterns. This skill teaches patterns for building maintainable test data in pytest through factory functions, builder patterns, and fixture factories. Learn to eliminate test data duplication by providing sensible defaults and easy customization for domain objects, complex structures, and parameterized datasets.
Use it when
- Pytest Test Data Factories covers how to use pytest factories by creating reusable factory patterns that simplify test setup.
- Yes, Pytest Test Data Factories teaches you to generate mock objects and fixtures automatically using factory-based approaches.
Install
dawiddutoit/custom-claude/pytest-test-data-factories · repository language: Python
generated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is Pytest Test Data Factories and how does it help?
Pytest Test Data Factories teaches patterns for building maintainable test data through factory functions, builder patterns, and fixture factories. This skill eliminates test data duplication by providing sensible defaults and easy customization for domain objects, complex structures, and parameterized datasets, making your pytest tests cleaner and more reusable.
How to use pytest factories for test setup?
Pytest Test Data Factories covers how to use pytest factories by creating reusable factory patterns that simplify test setup. You'll learn to build factory functions and fixture factories that generate mock objects and test data automatically, reducing boilerplate and allowing you to focus on test logic rather than data preparation.
Can Pytest Test Data Factories help generate mock data?
Yes, Pytest Test Data Factories teaches you to generate mock objects and fixtures automatically using factory-based approaches. The skill covers techniques for creating mock data that's easy to customize, letting you build complex test objects with minimal code while maintaining sensible defaults for common scenarios.
What factory pattern approaches does this skill cover?
Pytest Test Data Factories covers the factory pattern for python testing, including factory functions, builder patterns, and fixture factories. You'll learn reusable factory patterns that work with pytest to create test objects, parameterized datasets, and complex structures without duplicating setup code across your test suite.
How does Pytest Test Data Factories improve test maintenance?
Pytest Test Data Factories improves test maintenance by teaching you to build factory-based testing approaches that centralize test data creation. Instead of scattering test object generation throughout your tests, factories provide a single source of truth for defaults and customization, making tests easier to update and understand.
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Create and manage test data factories for pytest”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Set up pytest with production-ready configuration patterns covering test discovery, async support, custom markers, and coverage reporting. Includes conftest.py hierarchy examples and fixture scoping strategies for consistent test behavior across environments.
This skill teaches you to thoroughly test domain layer code using pytest, covering value object validation and immutability, entity identity and business logic, and domain invariants. Learn patterns for reaching 95%+ coverage on pure domain models without external dependencies or mocks.
Master testing strategies for adapters connecting to external systems. Learn when to mock HTTP responses with aioresponses, spin up real services with testcontainers, and handle error paths in Kafka and other integrations.
Learn a decision-driven framework for mocking in pytest that separates external boundaries from business logic. This skill covers autospec enforcement, async mock patterns, reusable mock factories, and a clear matrix for what to mock versus what to test directly. Master the golden rule—mock external dependencies, test the unit in isolation—to write tests that survive refactoring.
Add type annotations to test functions and fixtures, then configure mypy to validate them during test runs. Use create_autospec for type-safe mocks that enforce interface contracts and catch typos at runtime.
Setup Pytest Fixtures guides you through building reusable test fixtures with factory patterns, async support, and proper conftest organization. Learn to structure fixtures across centralized utilities and layer-specific configurations, then apply them across your test suite.
More skills Pytest Application Layer Testing (unlicensed)