pytest-skill

Generate pytest tests in Python with fixtures, parametrization, mocking, and conftest patterns.

350|69|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/LambdaTest/agent-skills --skill pytest-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-skill
Source: https://github.com/LambdaTest/agent-skills/tree/main/pytest-skill
Command: npx skills add https://github.com/LambdaTest/agent-skills --skill pytest-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill empowers you to write comprehensive, production-grade unit and integration tests in Python using the pytest framework, ensuring code reliability and maintainability.

Core Features & Use Cases

  • Fixture Management: Define and utilize fixtures for setup, teardown, and dependency injection.
  • Parametrization: Run tests with multiple data sets efficiently.
  • Mocking: Isolate components by mocking external dependencies.
  • Use Case: Generate a complete pytest suite for a new Python API endpoint, including fixtures for database connections, parametrization for different request payloads, and mocking for external service calls.

Quick Start

Generate a basic pytest test file for a Python function that adds two numbers.

Frequently Asked Questions about pytest-skill

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

FAQPage Schema
How do I write pytest tests with fixtures for setup and teardown?

Generate pytest tests using parametrization to execute a single test function with multiple data sets. This approach enables efficient data-driven testing by injecting various parameters directly into your test logic.

What is the best way to isolate components by mocking external dependencies in pytest?

Isolate components by mocking external dependencies using advanced mocking strategies within your pytest suite. This ensures test isolation by preventing external service calls from affecting your unit testing results.

Can I use conftest patterns for dependency management across multiple pytest files?

Yes, conftest patterns support dependency management by sharing fixtures across multiple test files. This allows you to centralize database connections and standardize test isolation throughout your Python project.

Does pytest support markers for organizing unit and integration testing?

pytest markers allow you to categorize and filter unit and integration tests. You can assign marker labels to test functions to selectively run specific test subsets during your development workflow.