sorenisanerd / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Attaching property mock with attach_mock adds call to mock_calls #207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

    >>> foo = Mock(name='foo')
    >>> prop = PropertyMock(name='prop')
    >>> type(foo).prop = prop
    >>> foo.attach_mock(prop, 'prop')
    >>> foo.mock_calls
    [call.prop(<PropertyMock name='foo.prop' id='4300017296'>)]

Expected:

    >>> foo.mock_calls
    []

What version of the product are you using? On what operating system?

    % pip freeze | grep mock
    mock==1.0.1

    OS X 10.8.4

Please provide any additional information below.

    It would be even cooler if attaching a property mock made calls to the property appear in the mock_calls for the hosting mock without having to attach it, the way it does with a non-property method :)

    I use mock every day now and am firmly of the opinion it is far, far more awesome than sliced bread. Thanks for making it available to the Python community :)

Original issue reported on code.google.com by stca...@gmail.com on 27 Jul 2013 at 3:52

GoogleCodeExporter commented 9 years ago

Original comment by fuzzyman on 4 Aug 2013 at 10:06