pytest

Guide Python test suite creation with pytest fixtures, parametrization, and markers.

11|2|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill pytest-the-perfect-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/the-perfect-developer/the-perfect-opencode/tree/main/.opencode/skills/pytest
Command: npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill pytest-the-perfect-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pytest guides developers in building robust, maintainable test suites by providing structured conventions and best practices for Python testing.

Core Features & Use Cases

  • Establishes project layouts for tests (tests/), fixtures, parametrization, and markers
  • Documents discovery conventions and configuration options to ensure consistent test runs across teams
  • Offers concrete patterns for fixtures, configuration, and test organization with real-world examples

Quick Start

Run pytest in your project root to discover and execute tests with the configured options.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I structure a Python test suite for maintainability and consistent test discovery?

To structure a Python test suite for maintainability, establish a dedicated tests/ directory and apply pytest conventions for file naming and test discovery. This ensures consistent test execution and predictable project layouts across teams.

What is the best way to design pytest fixtures for scalable testing patterns?

The best way to design pytest fixtures is to use structured patterns that manage setup and teardown logic independently. This approach enforces conventions in fixture design, ensuring your test suites remain maintainable as project sizes scale.

How do I configure pytest markers and parametrization for complex unit tests?

To configure pytest markers and parametrization for unit tests, apply established configuration tuning patterns to manage test variations and categorize test runs. This allows selective test execution and structured parameter coverage across your project.

Can I use pytest to enforce conventions across multiple Python projects of various sizes?

Yes, you can use pytest to enforce testing conventions across multiple Python projects of various sizes. It provides structured configuration tuning and project layout standards that ensure consistent test runs and maintainable test suites across different teams.

Why does pytest test discovery fail to find my Python unit tests?

Pytest test discovery fails to find unit tests when file naming and project layouts do not match the expected conventions. By documenting discovery conventions and applying the correct configuration options, you can ensure your tests are reliably located and executed.