pytest

Provide pytest testing patterns and examples for Python projects.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/sebasmzg/sebas.dot --skill pytest-sebasmzg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest
Source: https://github.com/sebasmzg/sebas.dot/tree/main/.config/opencode/skill/pytest
Command: npx skills add https://github.com/sebasmzg/sebas.dot --skill pytest-sebasmzg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, reusable patterns and examples to reduce friction when writing Python tests, helping developers structure tests, manage fixtures, and apply mocking and markers correctly.

Core Features & Use Cases

  • Fixture patterns and lifecycle management for isolated and reusable test setups.
  • Mocking and MagicMock usage examples for isolating external services and verifying interactions.
  • Parametrization guidance for concise coverage of multiple input cases and async test examples for coroutine-based code.
  • Marker and test selection strategies for slow, integration, or platform-specific tests and common pytest CLI usage for local development and CI pipelines.

Quick Start

Ask the pytest skill for fixture, mocking, and parametrization examples tailored to a specific Python module or test scenario.

Frequently Asked Questions about pytest

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

FAQPage Schema
How do I write parametrized tests in Python to cover multiple input cases?

Parametrized tests in Python allow you to run the same test logic against multiple inputs. You can use the parametrize decorator to define input sets and expected outcomes, ensuring concise coverage for various test scenarios without duplicating code.

What is the best way to manage fixture lifespans for isolated Python tests?

Fixture lifecycle management controls test setup and teardown to keep tests isolated. You can define fixture scopes like function, class, or session to manage reusable states and optimize test execution speed.

How does mocking work when isolating external services in Python unit tests?

Mocking in Python tests isolates external services by replacing real dependencies with MagicMock objects. This allows you to simulate service responses, verify interactions, and prevent tests from hitting live networks.

Can I run async tests for coroutine-based Python code?

Yes, you can run async tests for coroutine-based Python code. Async test examples enable testing asynchronous functions by handling event loops properly, ensuring your coroutine-based code executes correctly during CI or local development.

How do I use markers to select slow or integration tests in a CI pipeline?

Markers categorize tests as slow, integration, or platform-specific. You can apply marker decorators and use CLI selection strategies to include or exclude specific test groups during local development or CI pipeline execution.