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)
This commit is contained in:
Andrej730
2024-09-02 16:36:00 +05:00
parent d77f57c68e
commit 7c542418e6
+4 -2
View File
@@ -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")