After a day of pushing 9 commits to a PR to finally get Travis to build a simple python package on python 2.6, 2.7, 3.3 and 3.4 I finally gave up and ripped out all of httpretty and replaced it with good old mock.patch()

I was getting all sorts of strange warnings in py3.3 and 3.4 got stuck all the time.
This is not the first time httpretty has been causing confusion so from now on I'm giving up on httpretty. Ithink it was too good to be true to work reliably. Honestly, it might be python's fault for not being better made available to cool libs like httpretty.

By the way, here's one of those errors where Python 3.4 just hangs which stopped being the case once I took out httpretty. And here you can see the clear failure to deactivate the monkeypatch even after the test is complete in Python 3.3.

Comments

Brian Curtin

httpretty has been breaking a lot of OpenStack projects lately with those releases that hang on 3.4. I just removed it entirely from my project and I think others are doing the same. Using mock directly is great and mostly what we switched to, but there were also a few cases where httpretty's idea was what we wanted, so requests-mock took its place: http://www.jamielennox.net/blog/2014/08/26/requests-mock/

mindflayer

Have a look at the module we presented at EuroPython 2013, it does support Py2/Py3 since the beginning, and it's also a platform to build mocks for everything that run on sockets.
https://github.com/mocketize/python-mocket

Peter Bengtsson

Cool! I'll check it out when time allows.

Anonymous

Hi Peter, I was having a look at the traffic summary on the mocket GitHub page and it pointed me to this post.
Did you have the chance to try the library? If so, what do you think about it?

Your email will never ever be published.

Previous:
How to slice a rune in Go March 16, 2015 Go
Next:
Autocompeter.com April 2, 2015 Go, JavaScript
Related by category:
How I run standalone Python in 2025 January 14, 2025 Python
get in JavaScript is the same as property in Python February 13, 2025 Python
How to resolve a git conflict in poetry.lock February 7, 2020 Python
Best practice with retries with requests April 19, 2017 Python
Related by keyword:
Mocking os.stat in Python November 8, 2009 Python
Mocking DBRefs in Mongoose and nodeunit April 14, 2011 MongoDB, JavaScript
Mocking a Python standard library March 14, 2008 Zope