New debug feature to purge HDF5 cache in case the cache is corrupted.

This commit is contained in:
Dion Moult
2022-01-11 11:24:13 +11:00
parent ba675c0d28
commit f08ed629b5
8 changed files with 43 additions and 0 deletions
+11
View File
@@ -43,3 +43,14 @@ class TestLoadExpress(NewFile):
schema = subject.load_express(os.path.join(cwd, "..", "files", "test.exp"))
assert schema.schema_name == "IFCROGUE"
return schema
class TestPurgeHdf5Cache(NewFile):
def test_run(self):
cache_dir = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache")
test_file = os.path.join(cache_dir, "test.h5")
if not os.path.isfile(test_file):
fp = open(test_file, "x")
fp.close()
subject.purge_hdf5_cache()
assert not [f for f in os.listdir(cache_dir) if f.endswith(".h5")]