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")