pytest

Run discovered Python tests with fixtures, parametrization, and markers.

15|2|Updated May 23, 2026
One-click install
npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill pytest-vkirill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/VKirill/antigravity-for-claude-code/tree/main/skills/pytest
Command: npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill pytest-vkirill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

pytest makes it easier to build a dependable automated test suite for Python by providing a powerful runner, a composable fixture system, and mature plugin support.

Core Features & Use Cases

  • Structured test discovery and execution: consistent naming conventions, targeted selection by node IDs, keywords, and markers.
  • Fixtures, parametrization, and marks: reusable setup/teardown with scoped fixtures, test case multiplication with parametrize, and conditional behavior with skip/xfail/custom marks.
  • Practical real-world testing: mocking with unittest.mock or the mocker fixture, async testing with pytest-asyncio, and coverage measurement with pytest-cov.

Quick Start

Use pytest to add unit tests for your Python codebase by covering setup/teardown with fixtures, expanding cases with parametrization, and validating outcomes with assertions.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I write reliable Python tests with fixtures and parametrization?

To write reliable Python tests, use pytest to apply composable scoped fixtures for setup and teardown, and multiply test cases using parametrization. This provides reusable test structures and consistent execution across unit and integration scenarios.

What is the best way to test asynchronous Python code with pytest?

Testing asynchronous Python code requires integrating the pytest-asyncio plugin. It allows the test runner to properly execute and await async test functions, preventing common failure modes like execution hangs and ensuring async logic is validated correctly.

How do I measure test coverage and run tests in parallel?

Measuring test coverage and running tests in parallel involves using pytest's plugin-based enhancements. Apply the pytest-cov plugin for coverage measurement and utilize parallel execution plugins to speed up test suite runs while maintaining strict reporting.

Why does my pytest fixture scope cause test failures or inconsistent state?

Fixture scoping issues cause test failures when setup and teardown lifecycles mismatch test isolation needs. Resolve this by adjusting fixture scopes to ensure consistent state across test boundaries and following pytest 9 strict marker and configuration practices.

Can I use unittest.mock for mocking in pytest test suites?

Yes, you can use unittest.mock or the mocker fixture for mocking in pytest test suites. This enables practical real-world testing by substituting dependencies, validating interaction calls, and isolating the code under test without modifying external systems.