You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/voidspace'closed_at=Nonecreated_at=<Date2014-04-16.16:19:15.626>labels= ['type-bug', 'library']
title='Attaching a PropertyMock records calls'updated_at=<Date2020-02-18.09:21:36.362>user='https://github.com/voidspace'
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 :)
Not sure, but I guess it would be easy to find out. It will need some digging into to find out where the actual bug is. It shouldn't be hard to find though.
Activity
voidspace commentedon Apr 16, 2014
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?
Please provide any additional information below.
merwok commentedon Apr 16, 2014
Are both of these lines needed?
voidspace commentedon Apr 22, 2014
Not sure, but I guess it would be easy to find out. It will need some digging into to find out where the actual bug is. It shouldn't be hard to find though.
pythongh-65454: avoid triggering call to a PropertyMock in __setattr__
gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.…
pythongh-65454: avoid triggering call to a PropertyMock in NonCallabl…
pythongh-65454: avoid triggering call to a PropertyMock in NonCallabl…
[3.12] gh-65454: avoid triggering call to a PropertyMock in NonCallab…
[3.13] gh-65454: avoid triggering call to a PropertyMock in NonCallab…
hugovk commentedon Jun 15, 2024
@blhsing Thank you for fixing a 10-year-old issue! 🎉
pythongh-65454: avoid triggering call to a PropertyMock in NonCallabl…
pythongh-65454: avoid triggering call to a PropertyMock in NonCallabl…