mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 22:50:04 +00:00
Bonsai tests: stop hardcoding STEP ids in boolean.feature
The two boolean.feature scenarios pinned representation item objects by
absolute STEP id (Item/IfcHalfSpaceSolid/90, the BBIM_Boolean pset text
[91]). Those ids shift every time any earlier entity allocation in an
empty project changes (latest instance: #8577 moved 90 to 86), so this
cluster re-breaks on unrelated commits.
Make the object-name and panel-text BDD steps run their argument through
replace_variables, the same substitution 'the variable' and the
connection steps already use, and have boolean.feature capture the real
ids from the IFC file (by_type(...)[0].id()) into variables at the point
the entities are created. The steps stay strict: the substituted name
must still resolve to exactly the named object, there is no wildcard
matching. Substitution is a no-op for every existing feature string
without a {variable} placeholder.
This change was made with the assistance of an AI tool.
(cherry picked from commit 45fa04a94b)
This commit is contained in:
committed by
Dion Moult
parent
4cd7a3a1ef
commit
d5f9c7b5c3
@@ -468,6 +468,7 @@ def i_trigger_operator(operator):
|
||||
@then(parsers.parse('I see "{text}"'))
|
||||
def i_see_text(text):
|
||||
assert panel_spy
|
||||
text = replace_variables(text)
|
||||
panel_spy.refresh_spy()
|
||||
assert [l for l in panel_spy.spied_labels if text in l], f"Text {text} not found in {panel_spy.spied_labels}"
|
||||
|
||||
@@ -602,6 +603,7 @@ def i_select_the_row_where_i_see_text_in_the_nth_list(text, nth):
|
||||
@then(parsers.parse('I don\'t see "{text}"'))
|
||||
def i_dont_see_text(text):
|
||||
assert panel_spy
|
||||
text = replace_variables(text)
|
||||
panel_spy.refresh_spy()
|
||||
assert not [l for l in panel_spy.spied_labels if text in l], f"Text {text} found in {panel_spy.spied_labels}"
|
||||
|
||||
@@ -1092,6 +1094,7 @@ def then_the_object_name_is_placed_in_the_collection_collection(name: str, colle
|
||||
@given(parsers.parse('additionally the object "{name}" is selected'))
|
||||
@when(parsers.parse('additionally the object "{name}" is selected'))
|
||||
def additionally_the_object_name_is_selected(name):
|
||||
name = replace_variables(name)
|
||||
obj = bpy.context.scene.objects.get(name)
|
||||
if not obj:
|
||||
total = len(bpy.context.scene.objects)
|
||||
@@ -1172,6 +1175,7 @@ def nothing_happens():
|
||||
@when(parsers.parse('the object "{name}" exists'))
|
||||
@then(parsers.parse('the object "{name}" exists'))
|
||||
def the_object_name_exists(name: str) -> bpy.types.Object:
|
||||
name = replace_variables(name)
|
||||
# Some objects from linked collections may share the same name. This disambiguates them.
|
||||
if name.startswith("Col:"):
|
||||
_, collection_name, name = name.split(":")
|
||||
@@ -1186,6 +1190,7 @@ def the_object_name_exists(name: str) -> bpy.types.Object:
|
||||
|
||||
@then(parsers.parse('the object "{name}" does not exist'))
|
||||
def the_object_name_does_not_exist(name) -> None:
|
||||
name = replace_variables(name)
|
||||
obj = bpy.data.objects.get(name)
|
||||
assert obj is None, f'The object "{name}" exists'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user