mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
style: fix formatting issues to comply with pre-commit hooks
This commit is contained in:
@@ -82,6 +82,7 @@ def test_dont_record_on_exception(tmpdir):
|
||||
|
||||
assert not os.path.exists(str(tmpdir.join("dontsave2.yml")))
|
||||
|
||||
|
||||
def test_set_drop_unused_requests(tmpdir, httpbin):
|
||||
my_vcr = vcr.VCR(drop_unused_requests=True)
|
||||
file = str(tmpdir.join("test.yaml"))
|
||||
|
||||
@@ -401,7 +401,7 @@ def test_used_interactions(tmpdir):
|
||||
interactions = [
|
||||
{"request": {"body": "", "uri": "foo1", "method": "GET", "headers": {}}, "response": "bar1"},
|
||||
{"request": {"body": "", "uri": "foo2", "method": "GET", "headers": {}}, "response": "bar2"},
|
||||
{"request": {"body": "", "uri": "foo3", "method": "GET", "headers": {}}, "response": "bar3"}
|
||||
{"request": {"body": "", "uri": "foo3", "method": "GET", "headers": {}}, "response": "bar3"},
|
||||
]
|
||||
file = tmpdir.join("test_cassette.yml")
|
||||
file.write(yaml.dump({"interactions": [interactions[0], interactions[1]]}))
|
||||
|
||||
@@ -348,8 +348,10 @@ class Cassette:
|
||||
"""List of new HTTP interactions (request/response tuples)"""
|
||||
new_interactions = []
|
||||
for request, response in self.data:
|
||||
if all(not requests_match(request, old_request, self._match_on)
|
||||
for old_request, _ in self._old_interactions):
|
||||
if all(
|
||||
not requests_match(request, old_request, self._match_on)
|
||||
for old_request, _ in self._old_interactions
|
||||
):
|
||||
new_interactions.append((request, response))
|
||||
return new_interactions
|
||||
|
||||
@@ -363,7 +365,7 @@ class Cassette:
|
||||
return {"requests": requests, "responses": responses}
|
||||
|
||||
def _save(self, force=False):
|
||||
if (len(self._played_interactions) < len(self._old_interactions)):
|
||||
if len(self._played_interactions) < len(self._old_interactions):
|
||||
force = True
|
||||
if force or self.dirty:
|
||||
self._persister.save_cassette(self._path, self._as_dict(), serializer=self._serializer)
|
||||
|
||||
Reference in New Issue
Block a user