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
This is not a bug, and instead by design to align with how pythons existing unittest Mock behave.
Though, I can kind-of agree with you that it would be a nicer experience if it would work like you suggest, but I think it's better and cleaner if it works like the already familiar mock api.
To get your desired outcome, you could utilize itertools, e.g.
Environment
Using the latest
respx==0.21.1
withpytest==8.0.0
andpytest-mock==3.12.0
Issue
Following the
respx
docs for mocking a response using both aside_effect
andreturn_value
raises aStopIteration
error.While the docs state the following as an example, the test does not actually pass.
Running the above via pytest I see:
Expectation
I would expect
respx
to catch thisStopIteration
error when areturn_value
is specified and return that value instead of propagating the error.The text was updated successfully, but these errors were encountered: