pytest

Write and organize Python tests using pytest fixtures, mocking, parametrization, and markers.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/statick88/dotfiles --skill pytest-statick88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/statick88/dotfiles/tree/main/amp/.agents/skills/pytest
Command: npx skills add https://github.com/statick88/dotfiles --skill pytest-statick88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write robust and efficient tests for their Python code, ensuring reliability and maintainability.

Core Features & Use Cases

  • Test Structure: Demonstrates basic test classes and assertion patterns.
  • Fixtures: Shows how to create reusable setup and teardown logic for tests.
  • Mocking: Illustrates how to isolate components by mocking external dependencies.
  • Parametrization: Enables running the same test with multiple data inputs.
  • Markers: Helps categorize and selectively run tests (e.g., slow, integration).
  • Use Case: When you need to write tests for a new Python feature, this Skill provides examples for setting up test data, simulating API calls, and verifying expected outcomes with various inputs.

Quick Start

Use the pytest skill to generate a basic test file for a Python function.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I write Python tests using pytest fixtures?

To write Python tests using pytest fixtures, you define reusable setup and teardown functions that provide initialized objects or states to your test methods, ensuring efficient and maintainable dependency injection.

How does mocking isolate dependencies in Python testing?

Mocking isolates dependencies in Python testing by substituting external components, such as API calls or database connections, with simulated objects to evaluate the target function's behavior independently of the external system.

Can I categorize and selectively run Python tests with markers?

Yes, you can categorize and selectively run Python tests using pytest markers, which allow you to assign custom tags like slow or integration to test functions and execute only the matching subsets during your test run.

What is the best way to organize Python testing patterns for maintainability?

The best way to organize Python testing patterns for maintainability involves combining pytest fixtures, mocking, parametrization, and markers to establish robust, reusable, and clearly categorized test structures.