-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Provide a helper to copy args #37
Comments
This is how a
|
Hi @blueyed, thanks for the suggestion. I think adding this functionality to I've never needed this functionality myself so I can't judge which approach would feel best from the user point of view, but if I have to choose I would rather have the first approach as it doesn't introduce a new fixture to a feature which I believe is not used that much. What do you think? |
@nicoddemus You can easily run into this issue when checking calls that happen in a loop and use e.g. a Please note that the We could also consider to have this for the current |
I agree. Are you working on a PR? |
@nicoddemus Feel free to take my patch from above. |
OK, thanks for the suggestion and patch. 😄 |
mock
will store references incall_args
andcall_args_list
(see https://docs.python.org/3/library/unittest.mock-examples.html#coping-with-mutable-arguments).I think that pytest-mock could provide a helper based on the example from the doc:
The following works (by extending the pytest-mock
mocker
fixture).Not sure if that's helpful enough and/or if there could be a
mocker_copy
fixture instead, which would handlenew_callable
not only forpatch()
.The text was updated successfully, but these errors were encountered: