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

py34 test failures:BadStatusLine errors in TestSessionFlow.{test_session_update,test_session_read_only} #283

Closed
msabramo opened this issue Dec 1, 2014 · 3 comments

Comments

@msabramo
Copy link
Contributor

msabramo commented Dec 1, 2014

py34 test failure: requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",)) errors in TestSessionFlow.test_session_update and TestSessionFlow.test_session_read_only

$ .tox/py34/bin/py.test -v --tb=short tests/test_sessions.py
============================================================================= test session starts ==============================================================================
platform darwin -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /Users/marca/dev/git-repos/httpie/.tox/py34/bin/python3.4
plugins: httpbin
collected 7 items

tests/test_sessions.py::TestSessionFlow::test_session_created_and_reused PASSED
tests/test_sessions.py::TestSessionFlow::test_session_update FAILED
tests/test_sessions.py::TestSessionFlow::test_session_read_only FAILED
tests/test_sessions.py::TestSession::test_session_ignored_header_prefixes PASSED
tests/test_sessions.py::TestSession::test_session_by_path PASSED
tests/test_sessions.py::TestSession::test_session_unicode PASSED
tests/test_sessions.py::TestSession::test_session_default_header_value_overwritten PASSED

=================================================================================== FAILURES ===================================================================================
_____________________________________________________________________ TestSessionFlow.test_session_update ______________________________________________________________________
tests/test_sessions.py:62: in test_session_update
    self.start_session(httpbin)
tests/test_sessions.py:48: in start_session
    env=self.env())
tests/utils.py:136: in http
    exit_status = main(args=args, **kwargs)
.tox/py34/lib/python3.4/site-packages/httpie/core.py:112: in main
    response = get_response(args, config_dir=env.config.directory)
.tox/py34/lib/python3.4/site-packages/httpie/client.py:31: in get_response
    read_only=bool(args.session_read_only),
.tox/py34/lib/python3.4/site-packages/httpie/sessions.py:65: in get_response
    response = requests_session.request(**requests_kwargs)
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:457: in request
    resp = self.send(prep, **send_kwargs)
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:595: in send
    history = [resp for resp in gen] if allow_redirects else []
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:595: in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:189: in resolve_redirects
    allow_redirects=False,
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:569: in send
    r = adapter.send(request, **kwargs)
.tox/py34/lib/python3.4/site-packages/requests/adapters.py:407: in send
    raise ConnectionError(err, request=request)
E   requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
----------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------
127.0.0.1 - - [01/Dec/2014 09:07:00] "GET /cookies/set?hello=world HTTP/1.1" 302 223
____________________________________________________________________ TestSessionFlow.test_session_read_only ____________________________________________________________________
tests/test_sessions.py:82: in test_session_read_only
    self.start_session(httpbin)
tests/test_sessions.py:48: in start_session
    env=self.env())
tests/utils.py:136: in http
    exit_status = main(args=args, **kwargs)
.tox/py34/lib/python3.4/site-packages/httpie/core.py:112: in main
    response = get_response(args, config_dir=env.config.directory)
.tox/py34/lib/python3.4/site-packages/httpie/client.py:31: in get_response
    read_only=bool(args.session_read_only),
.tox/py34/lib/python3.4/site-packages/httpie/sessions.py:65: in get_response
    response = requests_session.request(**requests_kwargs)
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:457: in request
    resp = self.send(prep, **send_kwargs)
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:595: in send
    history = [resp for resp in gen] if allow_redirects else []
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:595: in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:189: in resolve_redirects
    allow_redirects=False,
.tox/py34/lib/python3.4/site-packages/requests/sessions.py:569: in send
    r = adapter.send(request, **kwargs)
.tox/py34/lib/python3.4/site-packages/requests/adapters.py:407: in send
    raise ConnectionError(err, request=request)
E   requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
----------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------
127.0.0.1 - - [01/Dec/2014 09:07:00] "GET /cookies/set?hello=world HTTP/1.1" 302 223
================================================================ 2 failed, 5 passed, 1 warnings in 1.03 seconds ================================================================

This seems to be related to an issue I uncovered adding a test to pytest-httpbin: kevin1024/pytest-httpbin#13

Using a pytest-httpbin with the fix in kevin1024/pytest-httpbin#16 seems to help. Observe:

$ .tox/py34/bin/pip uninstall -y pytest-httpbin
Uninstalling pytest-httpbin:
  Successfully uninstalled pytest-httpbin

$ .tox/py34/bin/pip install https://github.com/msabramo/pytest-httpbin/archive/fix_lots_of_requests_in_single_session.zip
...
Successfully installed pytest-httpbin
Cleaning up...

$ .tox/py34/bin/py.test --tb=short tests/test_sessions.py
============================================================================= test session starts ==============================================================================
platform darwin -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
plugins: httpbin
collected 7 items

tests/test_sessions.py .......

===================================================================== 7 passed, 1 warnings in 0.80 seconds =====================================================================
@msabramo msabramo changed the title py34 test failure: requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",)) errors in TestSessionFlow.test_session_update and `TestSessionFlow.test_session_read_only py34 test failures:BadStatusLine errors in TestSessionFlow.{test_session_update,test_session_read_only} Dec 1, 2014
@msabramo
Copy link
Contributor Author

msabramo commented Dec 1, 2014

kevin1024/pytest-httpbin#16 was merged to master

@msabramo
Copy link
Contributor Author

msabramo commented Dec 3, 2014

https://pypi.python.org/pypi/pytest-httpbin/0.0.5 uploaded to PyPI.

Those errors are not occurring for me now.

$ tox -e py26,py27,py33,py34 -- -q --tb=short tests/test_sessions.py ./tests
...
  py26: commands succeeded
  py27: commands succeeded
  py33: commands succeeded
  py34: commands succeeded
  congratulations :)

@msabramo msabramo closed this as completed Dec 3, 2014
@jkbrzt
Copy link
Member

jkbrzt commented Jan 19, 2015

Thank you for fixing those issues in pytest-httpbin!

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

2 participants