1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Merge pull request #763 from danielnsilva/drop-unused-requests

Add an option to remove unused requests from cassette
This commit is contained in:
Sebastian Pipping
2025-01-11 20:51:28 +01:00
committed by GitHub
5 changed files with 91 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ class VCR:
func_path_generator=None,
decode_compressed_response=False,
record_on_exception=True,
drop_unused_requests=False,
):
self.serializer = serializer
self.match_on = match_on
@@ -81,6 +82,7 @@ class VCR:
self.decode_compressed_response = decode_compressed_response
self.record_on_exception = record_on_exception
self._custom_patches = tuple(custom_patches)
self.drop_unused_requests = drop_unused_requests
def _get_serializer(self, serializer_name):
try:
@@ -151,6 +153,7 @@ class VCR:
"func_path_generator": func_path_generator,
"allow_playback_repeats": kwargs.get("allow_playback_repeats", False),
"record_on_exception": record_on_exception,
"drop_unused_requests": kwargs.get("drop_unused_requests", self.drop_unused_requests),
}
path = kwargs.get("path")
if path: