-
-
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
Record multiple calls to spy #378
Comments
Any thoughts on this? |
Sorry seems I missed this one. I think About exceptions, I don't think we have similar support for "list of exceptions" in MagicMock (or even normal exceptions for that matter) to draw from, but keeping consistency with However I would not implement Having said that, I would love to review a PR which adds |
Related to pytest-dev#378
Hi, I have a use case where I'd like to use
mocker.spy()
to record all calls to and return values from a callable, however as far as I can tellmocker.spy()
only records the most recent call (asspy_return
).Would you welcome a merge request adding this, and if so, do you have any opinions on the API?
I was thinking of something like
spy_returns
orspy_return_list
, which would be a list of return values. I'm not sure how best to handle exceptions - put the return values and exceptions in the same list so the user can determine order, or have two lists? Alternatively just assume that if you're expecting an exception there's less likely to be a need to call it multiple times.The text was updated successfully, but these errors were encountered: