test_feature - restore EPset_Drawing.ifc

This commit is contained in:
Andrej730
2025-11-17 12:14:55 +05:00
parent 99ae768ddf
commit 1508c4ab05
+12
View File
@@ -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)