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
{{ message }}
Repository navigation
spy.reset_mock(side_effect=True) makes spies stop calling the spied code #636
mocker.spy() calls the spied code from the spy's side_effect. #633 made mocker.resetall(side_effect=True) restore it after the reset, but calling reset_mock(side_effect=True) on the spy itself still clears it, so the spy returns a MagicMock from then on:
Reproduced on 3.16.1. It affects spies whose mock is a MagicMock: classmethods, staticmethods, builtins and classes. Spies on functions and methods are autospecced functions whose reset_mock() takes no arguments, so they aren't affected today.
Fixing it means handling the reset on the spy object itself (for example overriding reset_mock on spies), since resetall() is not involved here.
Activity
Keep spies calling through after spy.reset_mock(side_effect=True) (py…