I want to count the number of times that a function is called, python patch has been recommended allowing me to call call_count
and things like assert_not_called
to verify just that.
My problem is that I want the function to perform just as it did, as its function is required for the tests and it's on dynamic data so I cannot simply hardcode the result.
with patch.object(shutil, 'copy') as mm:
do_some_things()
mm.assert_not_called()
For do_some_things()
to work correctly, shutil.copy still needs to perform its original role