How do you mock readonly with mock ?
I tried:
setattr(obj.__class__, 'property_to_be_mocked', mock.Mock())
but the problem is that it applies to all instances of the class ... which breaks my tests.
Do you have another idea? I do not want to scoff at a complete object, only this specific property.
python unit-testing mocking
charlax Aug 06 '12 at 21:45 2012-08-06 21:45
source share