From 1508c4ab0533f45e3e83a860e32cc56ceeeabab3 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 17 Nov 2025 12:14:55 +0500 Subject: [PATCH] test_feature - restore EPset_Drawing.ifc --- src/bonsai/test/bim/test_feature.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bonsai/test/bim/test_feature.py b/src/bonsai/test/bim/test_feature.py index 87b1a4860e..bcfcdfba47 100644 --- a/src/bonsai/test/bim/test_feature.py +++ b/src/bonsai/test/bim/test_feature.py @@ -72,6 +72,10 @@ TEST_FILES_DIR = Path.cwd() / "test/files" CLEAN_LINKED_FILES_CACHE = False +EPSET_DRAWING = Path.cwd() / "bonsai/bim/data/pset/EPset_Drawing.ifc" +EPSET_DRAWING_BYTES = EPSET_DRAWING.read_bytes() +RELOAD_EPSET_DRAWING = False + class PanelSpy: def __init__(self, blender_panel: type[bpy.types.Panel]): @@ -308,6 +312,12 @@ def run_for_each_test() -> Generator[None]: filepath.unlink() CLEAN_LINKED_FILES_CACHE = False + # pset_template tests are editing EPset_Drawing.ifc, so we need to restore it. + global RELOAD_EPSET_DRAWING + if RELOAD_EPSET_DRAWING: + EPSET_DRAWING.write_bytes(EPSET_DRAWING_BYTES) + RELOAD_EPSET_DRAWING = False + @given("an untestable scenario") def an_untestable_scenario(): @@ -699,6 +709,8 @@ def i_select_the_item_name_item_in_the_list_name_list(item_name: str, list_name: @when("I load a new pset template file") def i_load_a_new_pset_template_file(): + global RELOAD_EPSET_DRAWING + RELOAD_EPSET_DRAWING = True props = tool.PsetTemplate.get_pset_template_props() IfcStore.pset_template_path = props.pset_template_files IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)