pytest

Guide pytest test writing, execution, debugging, fixtures, and parametrization.

20|5|Updated Nov 2, 2025
One-click install
npx skills add https://github.com/GhostTypes/ff-5mp-hass --skill pytest-ghosttypes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/GhostTypes/ff-5mp-hass/tree/main/.claude/skills/pytest
Command: npx skills add https://github.com/GhostTypes/ff-5mp-hass --skill pytest-ghosttypes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to the pytest framework, enabling users to write, run, and debug Python tests efficiently. It addresses the need for robust and scalable testing practices in software development.

Core Features & Use Cases

  • Test Writing: Learn to write basic tests, use fixtures, parametrize tests, and apply markers.
  • Test Execution: Understand pytest's command-line interface for running tests, filtering, and debugging.
  • Advanced Concepts: Explore fixtures, conftest.py, test discovery, and configuration options.
  • Use Case: A developer needs to ensure their Python application has thorough test coverage. They can use this Skill to quickly set up a testing environment, write effective tests for various scenarios, and integrate pytest into their workflow.

Quick Start

Use the pytest skill to write a basic test function that asserts a condition.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I write and run unit tests in Python using pytest?

Pytest fixtures allow you to manage test setup by providing reusable baseline context and resources for test functions. You define them explicitly and inject them into tests dynamically to ensure scalable testing environments.

What is the best way to run specific Python tests with pytest?

The best way to run specific Python tests with pytest is by using its command-line interface to apply filtering. You can target individual test files, functions, or apply markers to execute only the selected functional tests.

When do I need to use parametrization in Python testing?

You need to use parametrization in Python testing when you want to run the same test function against multiple sets of inputs and expected outputs. This mechanism eliminates duplication and ensures broad test coverage efficiently.

Do I need to know Python syntax to start debugging with pytest?

Yes, you need a solid understanding of Python syntax and basic testing principles to start debugging with pytest. This prerequisite knowledge is required to write effective tests and interpret the framework's debugging output.