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
HTTPretty breaking other URLs #65
Comments
This appears to be caused by a 301 redirect. If I change the code to response = requests.get('http://google.com/', allow_redirects=False) it doesn't fail. |
I have this problem too. In my case the problem is not solved with disabling redirects. The root cause is that HTTPretty does not understand
the
The real solution would require HTTPretty not loading the real server's response in one go. |
Found this issue too, it's possible to reproduce using: import requests
import httpretty
httpretty.enable()
httpretty.register_uri(httpretty.GET, "http://yipit.com/",
body="Find the best daily deals")
print requests.get('http://www.bing.com/') That code will trigger the |
Experimented with select.select for fixing the issue andresriancho@f6e59f4 and it seems to work, but some tests don't pass. I assume that the tests that aren't passing are because:
The code with select.select passes the simple test I sent before. |
I don't really have more time to spend on this, if someone else (@gabrielfalcao?) wants to take a look at the tests, that would be awesome. Also, please decide a value for SELECT_TIMEOUT. |
ping @gabrielfalcao |
I'm running into this as well (on 0.8.0): >>> import httpretty
>>> import requests
>>> assert requests.get('http://www.google.com').status_code == 200
>>> httpretty.enable()
>>> assert requests.get('http://www.google.com').status_code == 200
^CTraceback (most recent call last):
<snip>
File "/usr/lib/python2.7/httplib.py", line 790, in send
self.sock.sendall(data)
File "/usr/local/lib/python2.7/dist-packages/httpretty/core.py", line 393, in sendall
self.real_sendall(data)
File "/usr/local/lib/python2.7/dist-packages/httpretty/core.py", line 336, in real_sendall
received = self.truesock.recv(self._bufsize)
KeyboardInterrupt
>>> assert requests.get('http://www.google.com', allow_redirects=False).status_code == 200
^CTraceback (most recent call last):
<same as above> Has there been any progress since @andresriancho's changes? I can spend some time on this. |
Since this was blocking (no pun intended) some work of mine, I decided to just jump in. A few notes:
|
Two other things:
I'm kind of confused as to why |
Oh, I see:
|
I'm having exactly the same problem and I confirm that it doesn't work with https calls. Is there any other way to do this? |
This is still happening and is a pretty big blocker. Is there any movement towards fixing this bug? |
I believe I'm still seeing this on 0.8.8. I've seen both the |
seeing this in both 0.8.8 and 0.8.9. |
I am getting when I run this:
I get (it sounds a bit like #182 except I get it for a uri not registered with HTTPretty) the request succeeds if I remove the decorator if I drop into ipdb I see that I do have httpretty==0.8.10 |
FWIW whatever they're doing differently... https://github.com/patrys/httmock works fine |
Still happening... getting a Related? |
@boazin is the |
Haven't tried the decorator. I have a boolean I need to check in a config to decide if I use the mock or the real URL, so I can't use the decorator - need to manually call |
I wouldn't consider this issue as closed (as of 0.8.14) |
I can confirm this issue on both Python 2.7 and 3.5. This is my test script:
On Python 2.7.6 it hangs on the
On Python 3.5.1 it produces:
This is all on Ubuntu 14.04, using httpretty 0.8.14. |
I went back to using https://github.com/getsentry/responses, which is doing a better job at what I need |
Using socket directly instead of httpretty to test timeouts, thanks to gabrielfalcao/HTTPretty#65. Handling ConnectionError errors. Pinning lint versions to avoid broken tests caused by bad dependenceis.
I'm having this same issue on fedora 25, with python 2.7.13, requests 2.13.1 and httpretty>0.6.4 (tried all the versions to 0.8.4, and since 0.6.4 they just hang). My test
So it seems that a change introduced on 0.6.5 broke it... |
Yep, definetly the EAGAIN 'fix' broke it for me: 1d6f94e (in the sense that right before that commit it still works, after it, it hangs and breaks) |
See gabrielfalcao/HTTPretty#65 Signed-off-by: David Caro <david@dcaro.es>
Downgrading to httpretty 0.6.4 works for me on Linux, but I get a new error on OSX, related to the proxy.
|
With the following test
I get
The text was updated successfully, but these errors were encountered: