Skip to content
Snippets Groups Projects

Handle bytes in YAML caching

Merged Erwan Rouchet requested to merge yaml-cache-bytes into master
1 file
+ 3
1
Compare changes
  • Side-by-side
  • Inline
+ 3
1
@@ -30,7 +30,9 @@ def cache_yaml(monkeypatch):
# Create a unique cache key for direct YAML strings
# and file descriptors
if isinstance(yaml_payload, str):
key = hashlib.md5(yaml_payload.encode("utf-8")).hexdigest()
yaml_payload = yaml_payload.encode("utf-8")
if isinstance(yaml_payload, bytes):
key = hashlib.md5(yaml_payload).hexdigest()
else:
key = yaml_payload.name
Loading