From 36c7465cf742e2766e4ee813140c276b2d759c8b Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Wed, 4 Jan 2023 21:59:58 +0000 Subject: [PATCH] docs: add drop_unused_requests option --- docs/advanced.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/advanced.rst b/docs/advanced.rst index fb287fa3..b335aa83 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -426,3 +426,16 @@ If you want to save the cassette only when the test succeedes, set the Cassette # Since there was an exception, the cassette file hasn't been created. assert not os.path.exists('fixtures/vcr_cassettes/synopsis.yaml') + +Drop unused requests +-------------------- + +Even if any HTTP request is changed or removed from tests, previously recorded +interactions remain in the cassette file. If set the ``drop_unused_requests`` +option to ``True``, VCR will not save old HTTP interactions if they are not used. + +.. code:: python + + my_vcr = VCR(drop_unused_requests=True) + with my_vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml'): + # your http here