You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I created a serializer and persister class. After the first run of tests, the cassettes are created, but when I run subsequently, network calls are made rather than using the stored cassettes. Does the current version have this functionality, it is mentioned in the docs but no extensive explanation is given. You can review the code samples below, perhaps there's something I am missing. Cheers
Here is a snippet of the serializer and persister classes:
import os
import pickle
class BinarySerializer:
@classmethod
def deserialize(cls, binary):
return pickle.loads(binary)
@classmethod
def serialize(cls, string):
return pickle.dumps(string)
class CustomPersister:
@classmethod
def load_cassette(cls, cassette_path, serializer=BinarySerializer):
try:
with open(cassette_path) as f:
cassette_content = f.read()
except OSError:
raise ValueError("Cassette not found.")
cassette = serializer.deserialize(cassette_content)
return cassette
@staticmethod
def save_cassette(cassette_path, cassette_dict,
serializer=BinarySerializer):
data = serializer.serialize(cassette_dict)
dirname, filename = os.path.split(cassette_path)
if dirname and not os.path.exists(dirname):
os.makedirs(dirname)
with open(cassette_path, "wb") as f:
f.write(data)
Hello, I created a serializer and persister class. After the first run of tests, the cassettes are created, but when I run subsequently, network calls are made rather than using the stored cassettes. Does the current version have this functionality, it is mentioned in the docs but no extensive explanation is given. You can review the code samples below, perhaps there's something I am missing. Cheers
Here is a snippet of the
serializer
andpersister
classes:Here is the snippet of
vcr
config:The text was updated successfully, but these errors were encountered: