mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
New debug feature to purge HDF5 cache in case the cache is corrupted.
This commit is contained in:
@@ -25,3 +25,9 @@ class TestParseExpress:
|
||||
debug.load_express("filename").should_be_called().will_return("schema")
|
||||
debug.add_schema_identifier("schema").should_be_called()
|
||||
subject.parse_express(debug, "filename")
|
||||
|
||||
|
||||
class TestPurgeHdf5Cache:
|
||||
def test_run(self, debug):
|
||||
debug.purge_hdf5_cache().should_be_called()
|
||||
subject.purge_hdf5_cache(debug)
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user