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
self
is not passed with specced/autospeccedPropertyMock
.MRE
The issue also occurs with:
spec
instead ofautospec
:mock.patch('module.class.thing', new=mock.PropertyMock(side_effect=thing_side_effect, spec=class.thing))
spec
andnew_callable
instead 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-
PropertyMock
s:Your environment
The text was updated successfully, but these errors were encountered: