From 7c542418e6e9a6c6afdfd6343773f15c7850fab7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 2 Sep 2024 16:36:00 +0500 Subject: [PATCH] fix create sheet test failing if bonsai and tests are on different disks It was failing on Windows with something like "ValueError: path is on mount 'L:', start on mount 'C:'". I guess it doesn't really occur in bonsai as sheets are typically stored next to the titleblocks (we used to use absolute paths awhile ago and now everything is relative to the ifc project) --- src/bonsai/test/tool/test_drawing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bonsai/test/tool/test_drawing.py b/src/bonsai/test/tool/test_drawing.py index ac522ab8cf..d4b392009e 100644 --- a/src/bonsai/test/tool/test_drawing.py +++ b/src/bonsai/test/tool/test_drawing.py @@ -69,11 +69,13 @@ class TestCreateSvgSheet(NewFile): ifc = ifcopenshell.file() ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject") tool.Ifc.set(ifc) + ifc_path = Path("test/files/temp/test.ifc").absolute() + bpy.ops.bim.save_project(filepath=str(ifc_path), should_save_as=True) document = ifc.createIfcDocumentInformation( Identification="X", Name="FOOBAR", - Scope="DOCUMENTATION", - Location=os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache", "X - FOOBAR.svg"), + Scope="SHEET", + Location=(ifc_path.parent / "layouts" / "X - FOOBAR.svg").as_posix(), ) uri = subject.create_svg_sheet(document, "A1") assert uri.endswith(".svg")