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

httpbin tests require network access #215

Closed
sbraz opened this issue Jun 27, 2018 · 6 comments · Fixed by #216
Closed

httpbin tests require network access #215

sbraz opened this issue Jun 27, 2018 · 6 comments · Fixed by #216
Assignees

Comments

@sbraz
Copy link
Contributor

sbraz commented Jun 27, 2018

Hi,
It seems that tests require network access. You modified pytest-httpbin to make it connect to the real website instead of the local version, why is that?
The Gentoo sandbox doesn't allow network access so this causes the tests to fail:

E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='httpbin.org', port=80): Max retries exceeded with url: /forms/post (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8ca79b8ac8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

Here is the full build.log.

@hemberger
Copy link
Contributor

hemberger commented Jun 27, 2018

I see only three tests that fail when I disconnect my internet:

tests/test_browser.py::test__request FAILED
tests/test_browser.py::test__request_file FAILED
tests/test_stateful_browser.py::test_new_control FAILED

It should be fairly simple to fix these, so I'll take a look at it now.

@hemberger hemberger self-assigned this Jun 27, 2018
@sbraz
Copy link
Contributor Author

sbraz commented Jun 27, 2018

test_new_control is using a hardcoded http://httpbin.org URL so it's quite easy to fix. The other two are using a form, I'm not sure how you can reinject the local httpbin URL into it.

@sbraz
Copy link
Contributor Author

sbraz commented Jun 27, 2018

Ah, we can probably replace the URL inside form_html by a {} placeholder and then form_html.format(httpbin.url)

hemberger added a commit to hemberger/MechanicalSoup that referenced this issue Jun 27, 2018
Fixes MechanicalSoup#215.

There were three tests that were still accessing http://httpbin.org.
By switching these to use the `httpbin` pytest fixture, we no longer
require any network access.
@hemberger
Copy link
Contributor

Indeed! Thanks for reporting the issue.

@sbraz
Copy link
Contributor Author

sbraz commented Jun 27, 2018

That branch works for me :) When can we hope to see a new release?

hemberger added a commit to hemberger/MechanicalSoup that referenced this issue Jun 27, 2018
Closes MechanicalSoup#215.

There were three tests that were still accessing http://httpbin.org.
By switching these to use the `httpbin` pytest fixture, we no longer
require any network access.

NOTE: I also checked a different checkbox on the form to reduce
line length in order to pass the flake8 tests.
@hemberger
Copy link
Contributor

I can make time to do a release next week, but I'll have to coordinate with @moy first. (@moy: I sent you a message on Gitter, but we can coordinate wherever is most convenient for you :)

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 a pull request may close this issue.

2 participants