mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
docs: add drop_unused_requests option
This commit is contained in:
@@ -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.
|
# Since there was an exception, the cassette file hasn't been created.
|
||||||
assert not os.path.exists('fixtures/vcr_cassettes/synopsis.yaml')
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user