def method_mock(request, cls, method_name, **kwargs):
    _patch = patch.object(cls, method_name, **kwargs)
    request.addfinalizer(_patch.stop)
    return _patch.start()
Return a mock for method *method_name* on *cls* where the patch is
dataset/ETHPy150Open python-openxml/python-docx/tests/unitutil/mock.py/method_mock