1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

update old cassette detection

This commit is contained in:
Kevin McCarthy
2014-05-06 19:37:46 -10:00
parent b43c63f284
commit a302874c6d
3 changed files with 41 additions and 28 deletions

View File

@@ -19,6 +19,13 @@ Deserializing: string (yaml converts from utf-8) -> bytestring
def deserialize(cassette_string, serializer):
data = serializer.deserialize(cassette_string)
if not isinstance(data, dict):
raise ValueError(
"Your cassette files were generated in an older version "
"of VCR. Delete your cassettes or run the migration script."
"See http://git.io/mHhLBg for more details."
)
requests = [Request._from_dict(r['request']) for r in data['interactions']]
responses = [compat.convert_to_bytes(r['response']) for r in data['interactions']]
return requests, responses