Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 90f225e

Browse files
berndhahnebachMoult
authored andcommitted
bimtester: improve submodule handling for step translation
1 parent f00040c commit 90f225e

4 files changed

Lines changed: 32 additions & 13 deletions

File tree

src/ifcbimtester/bimtester/features/steps/ifcdata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from behave import step
22

3+
from utils import assert_schema
34
from utils import IfcFile
45

56

@@ -13,10 +14,9 @@ def step_impl(context, file):
1314

1415
@step("IFC data must use the {schema} schema")
1516
def step_impl(context, schema):
16-
assert IfcFile.get().schema == schema, "We expected a schema of {} but instead got {}".format(
17-
schema, IfcFile.get().schema
18-
)
19-
17+
context.schema = IfcFile.get().schema
18+
assert_schema(schema, context.schema)
19+
2020

2121
@step('The IFC file "{file}" is exempt from being provided')
2222
def step_impl(context, file):
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
from behave import step
22

3-
# https://behave.readthedocs.io/en/latest/api.html#step-macro-calling-steps-from-other-steps
3+
from utils import assert_schema
4+
45

6+
# https://behave.readthedocs.io/en/latest/api.html#step-macro-calling-steps-from-other-steps
7+
# https://stackoverflow.com/questions/46735425/how-to-only-show-failing-tests-from-behave
8+
# https://community.osarch.org/discussion/comment/4533/#Comment_4533
59

6-
@step("Die IFC daten müssen das {schema} Schema benutzen")
10+
@step("Die IFC Daten müssen das {schema} Schema benutzen")
711
def step_impl(context, schema):
8-
context.execute_steps(
9-
"* IFC data must use the {schema} schema".format(schema=schema)
10-
)
12+
try:
13+
context.execute_steps(
14+
"* IFC data must use the {schema} schema".format(schema=schema)
15+
)
16+
except Exception:
17+
assert_schema(schema, context.schema)
18+
# TODO translate error
19+
# "Wir haben ein Schema {} erwartet, aber die Daten sind Schema (}"
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
from behave import step
22

3-
# https://behave.readthedocs.io/en/latest/api.html#step-macro-calling-steps-from-other-steps
3+
from utils import assert_schema
44

55

66
@step("Les données IFC doivent utiliser le schéma {schema}")
77
def step_impl(context, schema):
8-
context.execute_steps(
9-
"* IFC data must use the {aschema} schema".format(aschema=schema)
10-
)
8+
try:
9+
context.execute_steps(
10+
"* IFC data must use the {schema} schema".format(schema=schema)
11+
)
12+
except Exception:
13+
assert_schema(schema, context.schema)

src/ifcbimtester/bimtester/features/steps/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,10 @@ def assert_pset(element, pset_name, prop_name=None, value=None):
7878
assert actual_value == value, 'We expected a value of "{}" but instead got "{}" for the element {}'.format(
7979
value, actual_value, element
8080
)
81+
82+
83+
def assert_schema(real_schema, target_schema):
84+
assert real_schema == target_schema, (
85+
"We expected a schema of {} but instead got {}"
86+
.format(target_schema, real_schema)
87+
)

0 commit comments

Comments
 (0)