You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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. 🤷 😄
The text was updated successfully, but these errors were encountered:
Yep, it could be a new CLI option that would work inside this conditionelif 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:
Extend pytest_addoption with a boolean option (similar to --disable-recording there)
Create a fixture enable_recording (similar to this)
Use the new enable_recording fixture insidevcr - elif vcr_markers or enable_recording:
Check that --disable-recording and --enable-recording are not used together (e.g. inside these fixture definitions)
Changelog entry
A test to verify this CLI option works + a test for conflicting options (as per notes above)
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 enablevcr
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
norpytest-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. 🤷 😄
The text was updated successfully, but these errors were encountered: