kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
425 stars 34 forks source link

Flag to turn on/off vcr #64

Closed MasterSergius closed 3 years ago

MasterSergius commented 3 years ago

Hi, I'd like to have some flag (the best option env variable), to turn on/off vcr for tests marked with @pytest.mark.vcr. By default it should work as is. But if I set env variable "USE_VCR=false" it should run real http requests and no cassetes should be rewritten. Or it is possible to achieve somehow with CLI options, custom decorators, etc?

MasterSergius commented 3 years ago

I'd like to make small update (until better solution is introduced): it's possible to override vcr fixture, thus I can turn it on/off in overridden fixture in many different ways.

Stranger6667 commented 3 years ago

Hi there!

Thank you for asking! Unfortunately, I didn't have much time to respond, but I will get back to you tomorrow :)

Stranger6667 commented 3 years ago

Or it is possible to achieve somehow with CLI options, custom decorators, etc?

I'd like to make small update (until better solution is introduced): it's possible to override vcr fixture, thus I can turn it on/off in overridden fixture in many different ways.

Yep, it is currently possible with overriding existing fixtures. #65 introduces the --disable-recording CLI option that completely disables the VCR.py integration, but I am not yet sure about adding an env variable - maybe env variables can be introduced later.

Stranger6667 commented 3 years ago

This feature is released in 0.11.0

MasterSergius commented 3 years ago

Thank you for quick action :)

Stranger6667 commented 3 years ago

You're very welcome! :)