{
    "content": "<h1>api\/Pytest-Mock<\/h1><p>The <a href=\"..\/Pytest-Mock\/\">Pytest-Mock<\/a> library is a specialized plugin for the <a href=\"..\/Pytest\/\">Pytest<\/a> framework that provides a thin wrapper around the standard <a href=\"..\/Python\/\">Python<\/a> <a href=\"..\/unittest.mock\/\">unittest.mock<\/a> library. Its primary goal is to make <a href=\"..\/Mocking\/\">Mocking<\/a> more idiomatic and easier to manage within test suites. By utilizing the <code>mocker<\/code> fixture, developers can perform <a href=\"..\/Patching\/\">Patching<\/a> without the boilerplate code often required by decorators or context managers.<\/p><p>Key features of <a href=\"..\/Pytest-Mock\/\">Pytest-Mock<\/a> include the automatic cleanup of mocks after each test, which prevents side effects from leaking into subsequent tests. It supports all standard <a href=\"..\/unittest.mock\/\">unittest.mock<\/a> functionalities, such as <code>mocker.patch()<\/code>, <code>mocker.patch.object()<\/code>, and <code>mocker.Mock()<\/code>. Furthermore, it offers unique utilities like <code>mocker.spy()<\/code> for tracking calls to existing functions and <code>mocker.stub()<\/code> for creating simple <a href=\"..\/Stub-Objects\/\">Stub-Objects<\/a>. This makes it an essential tool for <a href=\"..\/Unit-Testing\/\">Unit-Testing<\/a> and maintaining <a href=\"..\/Software-Quality\/\">Software-Quality<\/a>.<\/p><p>For more information, visit the <a href=\"https:\/\/github.com\/pytest-dev\/pytest-mock\">Official Pytest-Mock GitHub Repository<\/a> or the <a href=\"https:\/\/pytest-mock.readthedocs.io\/\">Official Documentation<\/a>. The library is widely adopted in the <a href=\"..\/Python\/\">Python<\/a> community for its simplicity and robustness in <a href=\"..\/Test-Driven-Development\/\">Test-Driven-Development<\/a> workflows.<\/p><ul><li><a href=\"..\/Pytest-Fixtures\/\">Pytest-Fixtures<\/a><\/li><li><a href=\"..\/Unit-Testing\/\">Unit-Testing<\/a><\/li><li><a href=\"..\/Mock-Objects\/\">Mock-Objects<\/a><\/li><li><a href=\"..\/Python-Testing\/\">Python-Testing<\/a><\/li><\/ul>",
    "tags": [
        "pytest",
        "python",
        "mocking",
        "testing",
        "pytest-mock",
        "unittest",
        "patching",
        "automation",
        "api",
        "unit-testing"
    ]
}