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
There are cases where one wants to use a spy as a means to hook into the call stack and change a parameter to alter the behavior of code further down the stack. One option would be to attach a side_effect to a previous spy or expectation, and use that side effect to alter the state of the module to be called on a subsequent execution of a spy. However, that's not always feasible and can be challenging to understand when reading a test.
This proposal is for a new method, inject_args, that would allow the user to hook into the spy and change the arguments. Probably the easiest approach is for this to accept a callable parameter, and give the user complete control over how to transform the original *args, **kwargs into what's needed for the test.
The text was updated successfully, but these errors were encountered:
There are cases where one wants to use a spy as a means to hook into the call stack and change a parameter to alter the behavior of code further down the stack. One option would be to attach a
side_effect
to a previous spy or expectation, and use that side effect to alter the state of the module to be called on a subsequent execution of a spy. However, that's not always feasible and can be challenging to understand when reading a test.This proposal is for a new method,
inject_args
, that would allow the user to hook into the spy and change the arguments. Probably the easiest approach is for this to accept acallable
parameter, and give the user complete control over how to transform the original*args, **kwargs
into what's needed for the test.The text was updated successfully, but these errors were encountered: