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

Reset requests before calling callbacks #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamielennox
Copy link
Owner

When a callback is invoked that calls requests the previous called mock
is run. When this is supposed to be a real_http request the
NoMockAddress is thrown but it can't be handled in the adapter and so
goes back to the outer send function.

This is all a problem and for a really unusual case because almost
surely if you are doing a requests call within a requests-mock callback
you're trying to do a real requests call. There's no point having a
callback that would simply point to something else you registered in the
same adapter.

So let's just assume that and reset all mocking whilst the callback code
may be run.

Change-Id: I9a426c54af778fcd536925744e78843854320a07

When a callback is invoked that calls requests the previous called mock
is run. When this is supposed to be a real_http request the
NoMockAddress is thrown but it can't be handled in the adapter and so
goes back to the outer send function.

This is all a problem and for a really unusual case because almost
surely if you are doing a requests call within a requests-mock callback
you're trying to do a real requests call. There's no point having a
callback that would simply point to something else you registered in the
same adapter.

So let's just assume that and reset all mocking whilst the callback code
may be run.

Change-Id: I9a426c54af778fcd536925744e78843854320a07
@jamielennox
Copy link
Owner Author

Moved from: https://review.openstack.org/#/c/399377/

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

Successfully merging this pull request may close these issues.

1 participant