When zeroing class attributes is moxused setattr. In this way,
mock.StubOutWithMock(myinstance, 'myproperty')
myinstance.myproperty = 'goodbye'
equivalently
saved = getattr(myinstance, 'myproperty')
mocked = MockAnything()
setattr(myinstance, 'myproperty', mocked)
Note that since it mypropertyis a property getattr, it setattrwill refer to the methods of the properties __get__and __set__, rather than actually "mock" the property itself.
, , .
mock.StubOutWithMock(myinstance.__class__, 'myproperty')
myinstance.myproperty = 'goodbye'
, , MyClass myproperty.