Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inject_args to spies #36

Open
awestendorf opened this issue Mar 10, 2020 · 0 comments
Open

Add inject_args to spies #36

awestendorf opened this issue Mar 10, 2020 · 0 comments

Comments

@awestendorf
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant