HTTPretty breaking other URLs
See original GitHub issueWith 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)
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:28 (9 by maintainers)
Top Results From Across the Web
HTTPretty Documentation
reset HTTPretty state (clean up registered urls and request␣ ... This analogy breaks down, though, because HTTPretty does not provide tools ...
Read more >Httpretty causes socket to lose connection? - Stack Overflow
If I use httpretty.enable(allow_net_connect=False) (When ... _rfile.read(num_bytes) break except (IOError, OSError) as e: if e.errno ...
Read more >HTTP Client Mocking Tool for Python - Morioh
@httpretty.activate def test_post_bodies(): url = 'http://httpbin.org/post' httpretty.register_uri(httpretty.POST, url, status=200) ...
Read more >Requests-mock - jamielennox.net
HTTPretty is a way to mock HTTP responses at the socket level, so it is not dependant ... import requests >>> import requests_mock...
Read more >Create Dynamic Links With URL Tag In Django - Vegibit
We do not want to hard code links in the template as they may break if the application changes in the future. ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.