pytest

Guide Python testing with pytest for unit, integration, and async tests.

Updated Dec 30, 2025
One-click install
npx skills add https://github.com/Salmanferozkhan/Cloud-and-fast-api --skill pytest-salmanferozkhan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/Salmanferozkhan/Cloud-and-fast-api/tree/main/.claude/skills/pytest
Command: npx skills add https://github.com/Salmanferozkhan/Cloud-and-fast-api --skill pytest-salmanferozkhan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solves the challenge of writing reliable, well-structured Python tests by delivering expert pytest guidance.

Core Features & Use Cases

  • Guided pytest workflows for unit, integration, and asynchronous tests across frameworks like FastAPI, Django, and Flask.
  • Comprehensive coverage of fixtures, markers, and mocking with practical examples and best practices.
  • Configuration, discovery, and debugging support for pytest using ini/pyproject.toml setups and test organization.

Quick Start

Run a minimal pytest example to verify the environment and validate basic test behavior.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I write reliable pytest fixtures for unit and integration testing in Python?

Pytest fixtures provide a reliable baseline for unit and integration testing by setting up preconditions and teardown logic. This guidance covers fixture creation, scoping, and parametrization to ensure maintainable test structures across Python applications.

Does pytest work with async tests for FastAPI and Django applications?

Yes, pytest supports asynchronous tests for FastAPI, Django, and Flask. The guidance includes specific workflows and configurations needed to handle async test execution and validate behavior within these Python web frameworks.

What is the best way to configure pytest using pyproject.toml?

Configuring pytest using pyproject.toml or ini files centralizes test settings and discovery rules. This approach ensures consistent test execution by defining paths, markers, and environment configurations in a single structured file.

How do I use mocking in pytest to isolate external dependencies?

Mocking in pytest isolates external dependencies by replacing actual objects with controlled test doubles. This guidance demonstrates how to implement mocking techniques to simulate API responses and database interactions for reliable unit tests.

Can I use pytest markers to organize and selectively run specific tests?

Yes, pytest markers allow you to organize and selectively run specific tests by applying custom labels. This guidance covers creating custom markers and configuring them in pyproject.toml to filter test execution efficiently.