pytest-mock-guide

Installation
SKILL.md

pytest-mock Usage Guide

pytest-mock is a pytest plugin providing a mocker fixture as a thin wrapper around Python's unittest.mock patching API. It automatically undoes all mocking at the end of each test.

The mocker Fixture

The mocker fixture is the main interface. Request it in your test function:

def test_example(mocker):
    # All mocks are automatically cleaned up after this test
    mock_func = mocker.patch("module.function")

Available Fixture Scopes

Fixture Scope Use Case
mocker function Default, per-test mocking
Related skills
Installs
1
GitHub Stars
2
First Seen
Apr 1, 2026