From e2001e82dd00bd7ad52ee4437b5468c2cd36ea0f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 23 Aug 2024 17:25:00 +0500 Subject: [PATCH] fix (hopefully) last failing test in github workflow --- src/bonsai/test/tool/test_debug.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bonsai/test/tool/test_debug.py b/src/bonsai/test/tool/test_debug.py index 9fcd8fa9a8..7f4c71f0e3 100644 --- a/src/bonsai/test/tool/test_debug.py +++ b/src/bonsai/test/tool/test_debug.py @@ -24,6 +24,7 @@ import bonsai.tool as tool from test.bim.bootstrap import NewFile from bonsai.tool.debug import Debug as subject from bonsai.bim.ifc import IfcStore +from pathlib import Path class TestImplementsTool(NewFile): @@ -52,10 +53,9 @@ class TestLoadExpress(NewFile): 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() + cache_dir = Path(bpy.context.scene.BIMProperties.data_dir) / "cache" + test_file = cache_dir / "test.h5" + test_file.parent.mkdir(parents=True, exist_ok=True) + test_file.touch() 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"]