-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Allow external requests #93
Conversation
How to allow external requests with |
@bersace : Like with rsps = RequestsMock(allow_external_requests=True)
@rsps.activate()
def test_some_stuff():
... |
ok. cool. |
Does this have a large benefit over doing the first request inside a |
@Daenyth : If you can make your request outside the with then no, there is no benefit. |
To add my 👍 to this: I wanted to add tests to a legacy function which uses |
i realize this is ancient, but I do want to get support for this in. That said, I'd like to have the behavior be something like |
I think this PR should be closed, as the functionality proposed here was added by #174 |
Cool thanks 👍 . |
Sometimes,you want to mock a specific service, but you still want to be able to reach other services. With this PR, if
allow_external_requests
isTrue
, calls to non mocked urls don't throwConnectionError
.This is somewhat similar to #39.
EDIT: If someone is interested by this behavior, note that change may never be included in responses, as per @dcramer's comment in #39.
If you need a way to mock an API while being able to make external requests, request-mock seems to be a good option.