use context manager to fix failing test
@@ -84,8 +84,8 @@ def _load_file_cache(filename: StringPathLike,
with open(filename, 'rb') as fin:
key = fin.read()
- cache: MutableMapping[bytes, Union[can.Database, diagnostics.Database]] = diskcache.Cache(cache_dir)
-
+ cache: MutableMapping[bytes, Union[can.Database, diagnostics.Database]]
+ with diskcache.Cache(cache_dir) as cache:
try:
return cache[key]
except KeyError:
