Pytest Configuration
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.
Pytest Configuration helps you set up pytest with pyproject.toml, markers, discovery patterns, and coverage reporting.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-01-26
Pytest Configuration helps you set up pytest with pyproject.toml, markers, discovery patterns, and coverage reporting. 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.
Use it when
- Pytest Configuration supports options like testpaths (directories to search).
- Pytest Configuration's pytest.ini setup involves defining [pytest] sections with your test discovery rules and markers.
Install
dawiddutoit/custom-claude/pytest-configuration · 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
How do I configure pytest for my project?
Pytest Configuration lets you set up the testing framework through pytest.ini, pyproject.toml, tox.ini, or setup.cfg files. Place configuration at your project root to define test discovery patterns, marker definitions, and plugin options. Use conftest.py files at different directory levels to manage fixture scoping and shared test utilities across your test suite.
What are the main pytest configuration options?
Pytest Configuration supports options like testpaths (directories to search), python_files/python_classes/python_functions (naming patterns), addopts (default command-line flags), markers (custom test markers), asyncio_mode (async test support), and filterwarnings (warning handling). Each option controls test discovery, execution behavior, and reporting output for consistent test runs.
How should I set up pytest.ini for my tests?
Pytest Configuration's pytest.ini setup involves defining [pytest] sections with your test discovery rules and markers. Specify testpaths to limit where pytest searches, register custom markers like @pytest.mark.slow or @pytest.mark.integration, and set addopts for default flags such as -v for verbose output or --strict-markers to catch typos in marker names.
What is conftest.py and how does Pytest Configuration use it?
Pytest Configuration uses conftest.py files to define fixtures, hooks, and shared test configuration at project or directory levels. Fixtures defined in conftest.py are automatically available to all tests in that directory tree. Use function, class, module, or session scope to control fixture lifetime and reuse, enabling consistent setup/teardown behavior across your entire test suite.
What are pytest configuration best practices?
Pytest Configuration best practices include: store config in pyproject.toml for single source of truth, use conftest.py hierarchy to organize fixtures by scope, register all custom markers to catch typos, set testpaths to speed up discovery, use strict-markers flag, and separate environment-specific settings via tox.ini or environment variables for CI/local consistency.
How do I troubleshoot pytest configuration issues?
Pytest Configuration troubleshooting starts with running pytest --version and pytest --co to verify discovery. Check for conftest.py conflicts across directory levels, validate pytest.ini syntax, use pytest -v to see which tests run, and enable pytest's debug mode with --setup-show to trace fixture execution and configuration loading order.
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 › “Configure pytest testing framework for project”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
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.
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.
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.
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.
Master async testing in Python with production-ready patterns for pytest-asyncio, async fixtures, and mocking. Covers FastAPI endpoints, Kafka clients, context managers, and async generators with proper event loop isolation.
pytest-config provides templates and patterns for pytest setup, conftest.py fixtures, test markers, and coverage configuration. It includes Git testing helpers, mock fixtures for Claude Code tools, and GitHub Actions integration to automate test execution across Python projects.
More skills Pytest Mocking Strategy (unlicensed) · python-testing (MIT) · Textual Test Fixtures (unlicensed) · Pytest Domain Model Testing (unlicensed) · Setup Pytest Fixtures (unlicensed) · Pytest Application Layer Testing (unlicensed) · testing-quality-standards (MIT) · Pytest Adapter Integration Testing (unlicensed)