# Mock support
-def make_mock_fixture(module, method, autouse=False):
+def make_mock_fixture(module, method, autouse=False, wraps=None):
'''Returns a pytest fixture that mocks a module's method or a class's
class method. "module" is a module or a class, but method is a string.
'''
@fixture(autouse=autouse)
def fix(monkeypatch):
mocked = mock.Mock(
- spec=getattr(module, method), name=method)
+ spec=getattr(module, method), name=method, wraps=wraps)
monkeypatch.setattr(module, method, mocked)
return mocked
return fix