jeudi 3 janvier 2019

Can I disable programatically vcrpy?

I have a bunch of tests using the VCR decorator from vcrpy library. I don't want recording to be enabled while developing tests, tests are slower. I was not able to enable/disable VCR recording, so I created a decorator which conditionally enables/disabled VCR recording, as below. Can VCR be disabled globally in a better way?

def my_vcr(func):
   if not vcr_enabled:
       return func
   return VCR().use_cassette(func)

Aucun commentaire:

Enregistrer un commentaire