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 VCR.py 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.
Additional arguments for the VCR constructor, as a dictionary. This will be overridden by marker and command-line options.
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.
Default: an instance of
This is the instance used for creating cassettes. You'd override this fixture to register your own matchers, serializers or persisters, for example:
@pytest.fixture(scope='module') 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
All options provided on the marker will be passed to the VCR constructor, for example:
@pytest.mark.vcr(ignore_localhost=True) def test_local_and_remote(): # This one will replay from the cassette urlopen('http://www.iana.org/domains/reserved').read() # This one will always be downloaded urlopen('http://127.0.0.1/').read()