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

tests test_playing_calls, test_callback_setting_headers_and_status_response error, fail #125

Closed
idella opened this issue Dec 2, 2013 · 4 comments

Comments

@idella
Copy link

idella commented Dec 2, 2013

/path/to/httpretty-0.7.0 $ PYTHONPATH=. nosetests tests

yields

.........................E..F....................................................................................
======================================================================
ERROR: HTTPretty should be able to record calls
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/tests/functional/test_requests.py", line 710, in test_playing_calls
    with HTTPretty.playback(destination):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 839, in playback
    cls.register_uri(method, uri, body=item['response']['body'], forcing_headers=item['response']['headers'])
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 885, in register_uri
    cls.Response(method=method, uri=uri, **headers),
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 908, in Response
    return Entry(method, uri, **headers)
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 497, in __init__
    self.validate()
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 522, in validate
    igot, self.body_length,
HTTPrettyError: HTTPretty got inconsistent parameters. The header Content-Length you registered expects size "73" but the body you registered for that has actually length "53".

======================================================================
FAIL: HTTPretty should call a callback function and uses it retur tuple as status code, headers and body requests
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/lib64/python2.7/site-packages/nose/util.py", line 613, in newfunc
    return func(*arg, **kw)
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/httpretty/core.py", line 1006, in wrapper
    return test(*args, **kw)
  File "/usr/lib64/python2.7/site-packages/sure/__init__.py", line 200, in wrap
    raise AssertionError(exc.pop(0))
AssertionError: Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/sure/__init__.py", line 177, in wrap
    func(start, *args, **kw)
  File "/mnt/gen2/TmpDir/portage/dev-python/httpretty-0.7.0/work/httpretty-0.7.0/tests/functional/test_requests.py", line 462, in test_callback_setting_headers_and_status_response
    expect(response.status_code).to.be(418)
  File "/usr/lib64/python2.7/site-packages/sure/__init__.py", line 420, in __call__
    assert self._ab.obj is other, "{0} should be the same object as {1}, but it is not".format(self._ab.obj, other)
AssertionError: 418 should be the same object as 418, but it is not

-------------------- >> begin captured stdout << ---------------------
(3182, 200000)

--------------------- >> end captured stdout << ----------------------
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS connection (1): api.yahoo.com
requests.packages.urllib3.connectionpool: DEBUG: "GET /test HTTP/1.1" 418 48
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 113 tests in 2.013s

FAILED (errors=1, failures=1)

I see there has been at least one other bug made citing wrong or inadequate listings of deps. The openstack people have made a practice of making a second file test-requirements.txt for, would you believe, test requirements. Just a helpful hint. Oh I found it; requirements.pip. Oh my

pypy 2 fails errors even more. You care for a listing?

@idella
Copy link
Author

idella commented Dec 2, 2013

Well I found my way to
jamielennox@3a7d5a0
&
jamielennox@ec954aa

diff -ur httpretty-0.7.0.orig/tests/functional/test_requests.py httpretty-0.7.0/tests/functional/test_requests.py
--- tests/functional/test_requests.py 2013-10-08 05:42:31.000000000 +0800
+++ tests/functional/test_requests.py 2013-12-02 15:43:48.763992391 +0800
@@ -698,7 +698,7 @@
response['response'].should.have.key("status").being.equal(200)
response['response'].should.have.key("body").being.an(unicode)
response['response'].should.have.key("headers").being.a(dict)

  • response['response']["headers"].should.have.key("server").being.equal("TornadoServer/2.4")
  • response['response']["headers"].should.have.key("server").being.equal("TornadoServer")

def test_playing_calls():

although appearing all good, in my system I get this extra new break. I suspect your next release will likely have it 'sorted'.

@gabrielfalcao
Copy link
Owner

@idella please don't run all the tests together.
I separated the tests in 2 folders: tests/unit and tests/functional, please run them separately because unit tests are isolated and functional tests have side effect in the environment.

@idella
Copy link
Author

idella commented Dec 3, 2013

got it thx

@idella
Copy link
Author

idella commented Dec 3, 2013

well as I thought very quick to close it.

/path/to/httpretty-0.7.0 $PYTHONPATH=../httpretty-0.7.0-python2_7/lib/ nosetests tests/functional/

yields the initial

.........................E..F...

still.
When is the next release?

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