fix (hopefully) last failing test in github workflow

This commit is contained in:
Andrej730
2024-08-23 17:25:00 +05:00
parent 92f4cb0ffa
commit e2001e82dd
+6 -6
View File
@@ -24,6 +24,7 @@ import bonsai.tool as tool
from test.bim.bootstrap import NewFile from test.bim.bootstrap import NewFile
from bonsai.tool.debug import Debug as subject from bonsai.tool.debug import Debug as subject
from bonsai.bim.ifc import IfcStore from bonsai.bim.ifc import IfcStore
from pathlib import Path
class TestImplementsTool(NewFile): class TestImplementsTool(NewFile):
@@ -52,10 +53,9 @@ class TestLoadExpress(NewFile):
class TestPurgeHdf5Cache(NewFile): class TestPurgeHdf5Cache(NewFile):
def test_run(self): def test_run(self):
cache_dir = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache") cache_dir = Path(bpy.context.scene.BIMProperties.data_dir) / "cache"
test_file = os.path.join(cache_dir, "test.h5") test_file = cache_dir / "test.h5"
if not os.path.isfile(test_file): test_file.parent.mkdir(parents=True, exist_ok=True)
fp = open(test_file, "x") test_file.touch()
fp.close()
subject.purge_hdf5_cache() subject.purge_hdf5_cache()
assert not [f for f in os.listdir(cache_dir) if f.endswith(".h5")] assert not [f for f in cache_dir.iterdir() if f.suffix == ".h5"]