Testing
1,251 installs
python-testing-patterns
by wshobson/agents
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites,…
Skill content
Comprehensive testing strategies for Python using pytest, fixtures, mocking, and test-driven development. - Covers unit, integration, functional, and performance testing with the AAA pattern (Arrange, Act, Assert) for test structure - Includes 10 fundamental and advanced patterns: basic tests, fixtures with setup/teardown, parameterization, mocking, exception handling, async testing, monkeypatching, temporary files, custom fixtures, and property-based testing - Provides test design principles, naming conventions, database testing, retry logic, time control with freezegun, markers, and coverage reporting - Includes CI/CD integration examples and configuration files (pytest.ini, pyproject.toml) for standardized test execution Python Testing Patterns Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices. When to Use This Skill - Writing unit tests for Python code - Setting up test suites and test infrastructure - Implementing test-driven development (TDD) - Creating integration tests for APIs and services - Mocking external dependencies and services - Testing async code and concurrent operations - Setting up continuous testing in CI/CD - Implementing property-based testing - Testing database operations - Debugging failing tests Core Concepts