HTTPretty: HTTPretty breaking other URLs
With the following test
@httprettified
def test_httpretty_should_not_override_other_urls():
u"HTTPretty shouldn't break other URLs"
HTTPretty.register_uri(HTTPretty.GET, "http://github.com/foo",
body="<root><baz /</root>")
response = requests.get('http://google.com/')
expect(response.status_code).to.equal(200)
I get
File "HTTPretty/tests/functional/test_requests.py", line 153, in test_httpretty_should_not_override_other_urls
response = requests.get('http://google.com/')
File "HTTPretty/lib/python2.7/site-packages/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "HTTPretty/lib/python2.7/site-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "HTTPretty/lib/python2.7/site-packages/requests/sessions.py", line 289, in request
history = [r for r in gen] if allow_redirects else []
File "HTTPretty/lib/python2.7/site-packages/requests/sessions.py", line 133, in resolve_redirects
proxies=proxies
File "HTTPretty/lib/python2.7/site-packages/requests/sessions.py", line 279, in request
resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
File "HTTPretty/lib/python2.7/site-packages/requests/sessions.py", line 374, in send
r = adapter.send(request, **kwargs)
File "HTTPretty/lib/python2.7/site-packages/requests/adapters.py", line 222, in send
r.content
File "HTTPretty/lib/python2.7/site-packages/requests/models.py", line 550, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "HTTPretty/lib/python2.7/site-packages/requests/models.py", line 496, in generate
chunk = self.raw.read(chunk_size)
File "HTTPretty/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 148, in read
return self._fp.read(amt)
File "python2.7/httplib.py", line 541, in read
return self._read_chunked(amt)
File "python2.7/httplib.py", line 592, in _read_chunked
value.append(self._safe_read(amt))
File "python2.7/httplib.py", line 649, in _safe_read
raise IncompleteRead(''.join(s), amt)
IncompleteRead: IncompleteRead(532 bytes read)
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 2
- Comments: 28 (9 by maintainers)
Commits related to this issue
- Experimenting with select.select to fix #65 IncompleteRead https://github.com/gabrielfalcao/HTTPretty/issues/65 — committed to andresriancho/HTTPretty by andresriancho 11 years ago
- Fixed httpretty timeout tests. Using socket directly instead of httpretty to test timeouts, thanks to https://github.com/gabrielfalcao/HTTPretty/issues/65. Handling ConnectionError errors. Pinning ... — committed to Robpol86/appveyor-artifacts by Robpol86 8 years ago
- packaging: pin httpretty to <6.5 due to bug See https://github.com/gabrielfalcao/HTTPretty/issues/65 Signed-off-by: David Caro <david@dcaro.es> — committed to david-caro/harvesting-kit by david-caro 7 years ago
I went back to using https://github.com/getsentry/responses, which is doing a better job at what I need
I wouldn’t consider this issue as closed (as of 0.8.14) Similar to @anentropic, I get a
BadStatusLine
from inside the boto package even though I don’t mock those requests (because I’m using fakes3 for testing). I’m also using enable/disable manually, because I’m using it in test setup to activate a special api mock, which can occur at any given point in the tests.