python-testing
Learn to build robust test suites using pytest with fixtures at multiple scopes, parameterized test cases, and mocking strategies. This skill covers async testing patterns, FastAPI application testing, and property-based testing approaches to ensure comprehensive coverage and maintainable test code.
python-testing teaches you to write comprehensive pytest tests with fixtures, mocking, and async support following current best practices.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-06-18
python-testing teaches you to write comprehensive pytest tests with fixtures, mocking, and async support following current best practices. Learn to build robust test suites using pytest with fixtures at multiple scopes, parameterized test cases, and mocking strategies. This skill covers async testing patterns, FastAPI application testing, and property-based testing approaches to ensure comprehensive coverage and maintainable test code.
Use it when
- python-testing covers mocking external dependencies and APIs using pytest-mock and unittest.mock.
- python-testing includes async testing patterns using pytest-asyncio.
Verify before relying
Read SKILL.md below before installing (2 files). Open directory: indexed for reading, not audited.
Install
JosiahSiegel/claude-plugin-marketplace/python-testing · repository language: Shell
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
How do I write pytest tests with fixtures and best practices?
python-testing teaches you to structure pytest tests using fixtures at multiple scopes (function, class, session, module). Best practices include organizing tests in conftest.py, using the Arrange-Act-Assert pattern, parameterizing test cases with @pytest.mark.parametrize, and leveraging fixture dependencies. The skill emphasizes clear test naming, isolated test cases, and proper setup/teardown management to create maintainable, robust test suites.
What's the best way to mock external APIs in Python tests?
python-testing covers mocking external dependencies and APIs using pytest-mock and unittest.mock. You'll learn to patch functions and methods, create Mock objects with return values, and verify call counts and arguments. The skill shows how to mock HTTP requests in FastAPI tests using httpx, configure mock side effects for error scenarios, and isolate your code from external services to ensure fast, reliable unit tests.
How can I test async code and FastAPI applications?
python-testing includes async testing patterns using pytest-asyncio. You'll learn to mark async test functions with @pytest.mark.asyncio, test FastAPI endpoints with httpx's AsyncClient, and handle async fixtures. The skill covers testing async dependencies, mocking async functions, and validating response status codes and JSON payloads in FastAPI applications without running a live server.
How do I configure code coverage and organize tests?
python-testing teaches coverage setup using pytest-cov, including pyproject.toml configuration for coverage thresholds and report formats. Test organization strategies include grouping tests by module, using pytest markers to categorize tests (unit, integration, slow), and skipping tests conditionally. The skill helps you structure test directories, manage test dependencies, and generate coverage reports to track code quality.
What are pytest parametrize examples and when should I use them?
python-testing demonstrates @pytest.mark.parametrize to run the same test with multiple input combinations, reducing code duplication. Examples include testing functions with various valid/invalid inputs, edge cases, and different data types. Parametrization pairs with fixtures for powerful test generation, allowing you to test comprehensive scenarios efficiently while keeping test code DRY and readable.
How does property-based testing with Hypothesis improve my tests?
python-testing introduces property-based testing using Hypothesis to generate random test inputs automatically. Instead of writing specific test cases, you define properties your code should satisfy for any valid input. Hypothesis finds edge cases and shrinks failures to minimal examples, catching bugs traditional unit tests miss. This strategy complements snapshot testing for regression detection and comprehensive test coverage.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Quick Reference
| pytest Command | Purpose |
|---|---|
pytest |
Run all tests |
pytest -v |
Verbose output |
pytest -k "name" |
Run tests matching pattern |
pytest -x |
Stop on first failure |
pytest --lf |
Run last failed |
pytest -n auto |
Parallel execution |
| Fixture Scope | Duration |
|---|---|
function |
Per test (default) |
class |
Per test class |
module |
Per test file |
session |
Entire test run |
| Mock Pattern | Code |
|---|---|
| Patch function | mocker.patch("module.func") |
| Return value | mock.return_value = {...} |
| Side effect | `mock.side_effect = [a, b, |
(truncated - see the full file via the links below)
File tree — 2 files
plugins/python-master/skills/python-testing/SKILL.md
plugins/python-master/skills/python-testing/references/pytest-fixtures-cookbook.md
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 › “Write comprehensive pytest tests with fixtures and best practices”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Master pytest for Python testing with guidance on fixtures, parametrization, markers, and mocking strategies. Learn test organization patterns, coverage best practices, and common commands to streamline your testing workflow.
Pytest is Python's industry-standard testing framework, built to handle the rigorous demands of customer support systems. This skill covers fixtures, parametrization, mocking, async operations, and database testing with PostgreSQL and SQLAlchemy—everything needed to test ticketing platforms, APIs, and multi-tenant architectures reliably.
Master pytest's core patterns for writing maintainable tests: fixtures for setup and teardown, parametrize for test variations, and monkeypatch for mocking. Learn test structure, granularity, and scope management to build fast, isolated unit tests that serve as executable documentation.
pytest is Python's standard testing framework, enabling developers to write organized unit and integration tests through fixtures for dependency injection and parametrization for data-driven test cases. It supports async code, multiple test discovery patterns, and integrates seamlessly with FastAPI, Django, and Flask, plus a rich plugin ecosystem for coverage, mocking, and parallel execution.
Pytest Patterns teaches you to write reliable Python tests using pytest's core features—fixtures for setup and teardown, parametrization to run tests with multiple inputs, and mocking to isolate dependencies. Learn test organization, coverage analysis, and CI/CD integration to scale from simple unit tests to complex test suites.
Pytest Patterns teaches structured testing for Python backends using pytest, httpx, and factory_boy. Learn to organize tests across unit and integration layers, build reusable fixtures with proper scoping, seed test data with factories, and test async FastAPI endpoints. Covers mocking, parametrization, and conftest hierarchy—but skips frontend and E2E testing.
More skills test-harness (MIT) · pytest-skill (MIT) · Pytest Async Testing (unlicensed) · squid-testing-python (Apache-2.0) · python-testing-patterns (MIT) · python-testing (MIT) · Textual Test Fixtures (unlicensed) · Setup Pytest Fixtures (unlicensed)