pythontestingintegration-testingvcr

Is there a python alternative to Ruby's VCR library?


I'd like to use the awesome "record/playback" mechanism of Ruby's VCR library or Betamax for the JVM. Is there a Python library that works the same way? If not, how do you test your REST client calls without worrying about the test being slow and flaky?


Solution

  • There is a Python port of VCR called VCR.py developed in the last years.

    If you already know how to use VCR and are comfortable with it, you might also consider running a local ruby proxy server (using something like rack) with VCR loaded into it. Then you can test code in any language...just make sure the HTTP requests are being proxied through your local server. This is one of the main uses of VCR's rack middleware. I've used this to test non-ruby code before and it worked great.