spec instead of autospec: mock.patch('module.class.thing', new=mock.PropertyMock(side_effect=thing_side_effect, spec=class.thing))
spec and new_callable instead of new: mock.patch('module.class.thing', spec=mock.create_autospec(class.thing, side_effect=thing_side_effect, new_callable=mock.PropertyMock)
WilliamDEdwards commentedDec 16, 2022
•
edited by AlexWaygood
Bug report
selfis not passed with specced/autospeccedPropertyMock.MRE
The issue also occurs with:
specinstead ofautospec:mock.patch('module.class.thing', new=mock.PropertyMock(side_effect=thing_side_effect, spec=class.thing))specandnew_callableinstead ofnew:mock.patch('module.class.thing', spec=mock.create_autospec(class.thing, side_effect=thing_side_effect, new_callable=mock.PropertyMock)Result
However, the same notation works for non-
PropertyMocks:Your environment
The text was updated successfully, but these errors were encountered: