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

Incorrect examples in documentation (contextmanager) #447

Open
romuald opened this issue Nov 5, 2021 · 2 comments
Open

Incorrect examples in documentation (contextmanager) #447

romuald opened this issue Nov 5, 2021 · 2 comments

Comments

@romuald
Copy link

romuald commented Nov 5, 2021

The examples for various context managers seems to be outdated.

For example: https://httpretty.readthedocs.io/en/1.1.4/api.html#httpretty.core.httprettized

In documentation:

httpretty.register_uri(httpretty.GET, 'https://httpbin.org/ip', body=json.dumps({'origin': '42.42.42.42'}))
with httpretty.enabled():
    response = requests.get('https://httpbin.org/ip')

Actual code needs the register_uri call to be made inside the with statement, otherwise it is not mocked

python version 3.7
httpretty version 1.1.4

@gabrielfalcao
Copy link
Owner

Thanks for the report @romuald

@zyzzyxdonta
Copy link

Another symptom of this issue is that the requests end up taking quite long. E.g. 75 seconds for a simple request.head(URL).

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

No branches or pull requests

3 participants