This plugin is configured, for the most part, by overriding py.test fixtures or passing options to the vcr marker.

Command line options


Selects the record mode. Useful in CI (where you want --vcr-record=none).


Disable replaying and recording. The VCR is still installed, but shouldn't affect the requests.

Configuration fixtures


Scope: module
Default: {}

Additional arguments for the VCR constructor, as a dictionary. This will be overridden by marker and command-line options.


Scope: module
Default: test_file_directory + "/cassettes/"

Path to the directory where cassettes should be stored.


Default: name of the test

Name of the current test's cassette.


Scope: module
Default: an instance of VCR

This is the instance used for creating cassettes. You'd override this fixture to register your own matchers, serializers or persisters, for example:

def vcr(vcr):
    vcr.register_matcher('my_matcher', my_matcher)
    vcr.match_on = ['my_matcher']  # This can also go into vcr_config or marker kwargs
    return vcr

Marker options

All options provided on the marker will be passed to the VCR constructor, for example:

def test_local_and_remote():
    # This one will replay from the cassette
    # This one will always be downloaded