mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 08:56:34 +00:00
bim.purge_hdf5_cache to skip currently loaded cache
Previously it would fail with: PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'bonsai\\bim\\data\\cache\\988c190483ae6bab7cf6b00cee78694d.h5'
This commit is contained in:
@@ -57,5 +57,10 @@ class TestPurgeHdf5Cache(NewFile):
|
||||
test_file = cache_dir / "test.h5"
|
||||
test_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
test_file.touch()
|
||||
|
||||
# Ensure it can skip currently loaded cache.
|
||||
loaded_file_path = test_file.with_stem("test_loaded")
|
||||
loaded_file = open(loaded_file_path, "w")
|
||||
|
||||
subject.purge_hdf5_cache()
|
||||
assert not [f for f in cache_dir.iterdir() if f.suffix == ".h5"]
|
||||
assert [f for f in cache_dir.iterdir() if f.suffix == ".h5"] == [loaded_file_path]
|
||||
|
||||
Reference in New Issue
Block a user