Issue mocking with a decorated method call in Python 2.7
This code: import mock from functools import wraps def dec(f): @wraps(f) def f_2(*args, **kwargs): pass return f_2 class Example(object): def __init__(self): pass @dec def method_1(self, arg): pass def method_2(self, arg): self.method_1(arg) def test_example(): m = mock.create_autospec(Example) Example.method_2(m, "hello") m.method_1.assert_called_once_with("hello") produces this error with py.test def test_example(): m = mock.create_autospec(Example) > Example.method_2(m, "hello") example.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _