pytest-mastery

Generate pytest suites with mocks, fixtures, and parametrize for unit tests.

4|2|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/nick-orton/vybz --skill pytest-mastery
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-mastery
Source: https://github.com/nick-orton/vybz/tree/main/src/vybz/library/skills/pytest-mastery
Command: npx skills add https://github.com/nick-orton/vybz --skill pytest-mastery

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Deep expertise in the pytest framework, mocking strategies, and Test Driven Development that helps teams write reliable, maintainable tests with clear patterns.

Core Features & Use Cases

  • Detailed guidelines for pytest usage and test organization
  • Advanced mocking strategies, fixtures, and parameterization
  • TDD-driven workflows that connect requirements to tests and code

Quick Start

Ask pytest-mastery to generate a minimal pytest suite that mocks a network call and validates behavior.

Frequently Asked Questions about pytest-mastery

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

FAQPage Schema
How do I write a pytest test suite that mocks a network call?

To mock a network call in pytest, you configure a test structure using advanced mocking strategies and fixtures. This isolates the code under test, ensuring hermetic unit tests that validate behavior without external dependencies.

What is the best way to organize pytest fixtures for unit and integration tests?

Organizing pytest fixtures requires detailed guidelines for pytest usage and test organization. Clear patterns and consistent naming conventions ensure maintainable tests across both unit and integration scenarios.

How does parametrize work for running multiple test cases in pytest?

Parametrize in pytest allows running the same test logic against multiple inputs. It connects to TDD-driven workflows by validating diverse data scenarios, ensuring robust behavior across unit and integration tests.

Can I use TDD workflows to connect requirements directly to pytest tests?

Yes, TDD-driven workflows connect requirements to tests and code. By writing pytest tests first, you establish clear test organization and robust mocking patterns that guide reliable Python code development.

Why does my pytest test fail when patching dependencies in unit tests?

Failing pytest tests during patching often indicate improper mocking strategies or non-hermetic test conditions. Applying robust mocking and patching patterns aligned with pytest best practices isolates the code under test correctly.