kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.68k stars 386 forks source link

Monkey patch socket. #8

Open bryanhelmig opened 11 years ago

bryanhelmig commented 11 years ago

Love the API you have (very similar to Ruby's VRC) and very nice code!

Another project I was toying around with (recently on HN, I believe I saw you comment) does something similar: https://github.com/gabrielfalcao/HTTPretty/

I've opened an issue over there with the idea of adding a record and playback context manager, almost exactly like your implementation. But, of course, patching at the lib level (httplib or urllib or whatever) is almost guaranteed to leave some higher level libraries out. Instead, maybe we could monkey patch sockit and ssl?

The HTTPretty implementation is fairly complex but it looks doable.

This is a pretty big pain point for us, so its definitely something we want to do. Not sure whether to invest the time in your lib or theirs!

bryanhelmig commented 11 years ago

Mentioned HTTPretty issue: https://github.com/gabrielfalcao/HTTPretty/issues/10

colonelpanic8 commented 9 years ago

@kevin1024 I know that this could take a ridiculous amount of work, and what essentially amounts ot a complete refactor, but have you ever thought about trying to use httppretty as the patching backend for vcrpy?

kevin1024 commented 9 years ago

Yup that would be amazing. I would love for vcrpy to work at a lower level instead of patching httplib. It would certainly make the maintenance easier!

Of course patching at the socket layer means we need to parse HTTP to support some features. There are some nice HTTP parsing libraries out there these days.

twolfson commented 8 years ago

As a heads up, we took a different approach and made a vcrpy-based dynamic callback to use on HTTPretty in #224.

neozenith commented 4 years ago

A lot of changes have happened to VCRpy since this ticket was opened. As this ticket has become stale, would you mind closing it if it is no longer needed / relevant?

If I haven't heard anything in a week I'll mark it as closed as we have a lot of old tickets that need to be groomed to make it easier to see what is still relevant.

However if it is still needed, please feel free to re-open or create a new ticket.

Thanks! 🙏