[TIP] vcr

Andrea Crotti andrea.crotti.0 at gmail.com
Tue Mar 27 08:39:34 PDT 2012

On 03/27/2012 02:24 PM, vanderson.mota at gmail.com wrote:
> VCR, as far as i know only works for HTTP. It is very easy to use, and 
> unfortunately i didn't find a match for it in python. It seems people 
> are more concerned about building "My new cool ruby-like test runner".
> The coding strategy to make VCR was to monkeypatch the Http Libraries, 
> like the basic Net::Http, since there are a lot of http clients use it 
> under the hood. And for the ones who don't, the author wrote an 
> adapter for the most popular ones[1].
> I think similar approach can be used with python.
> 1: https://github.com/myronmarston/vcr/tree/master/lib/vcr/library_hooks

Yes it should be feasible, and true it seems that the Ruby community has 
much more ferment in this area.

Anyway it would be great to do the same thing recording directly the 
TCP/IP streams.
There are probably a few problems with that:
1. need to be root to sniff the network traffic
2. might need to rewrite a lot of packets when replaying because they 
depend on the specific
     network configuration of the machine

so maybe it's not really easy after all, what do you think?

More information about the testing-in-python mailing list