kiwicom / pytest-recording

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

Allow using `pytest-recording` with a command-line flag only #109

Open Peque opened 1 year ago

Peque commented 1 year ago

It seems like right now you need to define which functions will make use of vcr with a decorator. It would be great if there was a way to automatically enable vcr for all tests without requiring any change in the source code.

For example, having a flag like pytest --vcr would automatically enable VCR for all requests.

This way, tests would run in any environment without vcr nor pytest-recording installed (i.e.: CI/CD/deployment) and, for those wanting to accelerate local testing, it would be as simple as installing the packages and adding the --vcr flag.

Not sure this is even possible. :shrug: :smile:

Stranger6667 commented 1 year ago

Hi!

Yep, it could be a new CLI option that would work inside this condition elif vcr_markers or enable_recording:

This feature should be relatively straightforward to implement, I don't have the capacity to work on it myself but I will assist with reviews. I see the following steps: