First batch of Pset Templates tests (#1772)

This commit is contained in:
Gorgious56
2021-10-09 13:26:23 +02:00
committed by GitHub
parent 84fc198bbe
commit e455f87305
3 changed files with 103 additions and 3 deletions
+15 -3
View File
@@ -18,6 +18,7 @@
import os
import bpy
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from pytest_bdd import scenarios, given, when, then, parsers
@@ -37,12 +38,23 @@ def replace_variables(value):
def an_empty_ifc_project():
IfcStore.purge()
bpy.ops.wm.read_homefile(app_template="")
while bpy.data.objects:
bpy.data.objects.remove(bpy.data.objects[0])
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
if len(bpy.data.objects) > 0:
while bpy.data.objects:
bpy.data.objects.remove(bpy.data.objects[0])
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
bpy.ops.bim.create_project()
@when("I load a new pset template file")
def i_load_a_new_pset_template_file():
IfcStore.pset_template_path = os.path.join(
bpy.context.scene.BIMProperties.data_dir,
"pset",
bpy.context.scene.BIMPsetTemplateProperties.pset_template_files + ".ifc",
)
IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
@given("I add a cube")
@when("I add a cube")
def i_add_a_cube():