Skip to content

Commit 4f7bf35

Browse files
add streamline changes do my bimtester 6
1 parent 449b281 commit 4f7bf35

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

src/ifcbimtester/bimtester/features/environment.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,15 @@ def before_all(context):
4343
# for some Scenarios True would be better, may be dependend on the Scenario name as a workaround
4444

4545
# context.ifc_path = userdata.get("ifc", "")
46-
context.ifcfile_basename = os.path.basename(
47-
os.path.splitext(userdata["ifc"])[0]
48-
)
46+
context.ifcfile_basename = os.path.basename(os.path.splitext(userdata["ifc"])[0])
4947
context.outpath = os.path.join(this_path, "..")
5048
context.create_log = True
5149
context.create_smartview = True
5250

5351
if context.create_log is True:
5452
# set up log file
55-
context.thelogfile = os.path.join(
56-
context.outpath,
57-
context.ifcfile_basename + ".log"
58-
)
59-
create_logfile(
60-
context.thelogfile,
61-
context.ifcfile_basename,
62-
)
53+
context.thelogfile = os.path.join(context.outpath, context.ifcfile_basename + ".log")
54+
create_logfile(context.thelogfile, context.ifcfile_basename)
6355

6456
# we have to use a dict to preserve the contents
6557
# https://stackoverflow.com/a/67606164
@@ -103,15 +95,9 @@ def before_feature(context, feature):
10395
# TODO: refactor zoom smart view support into a decoupled module
10496
if context.create_smartview is True:
10597
smartview_name = context.ifcfile_basename + "_" + feature.name
106-
context.smview_file = os.path.join(
107-
context.outpath,
108-
smartview_name + ".bcsv"
109-
)
98+
context.smview_file = os.path.join(context.outpath, smartview_name + ".bcsv")
11099
# print("SmartView file: {}".format(context.smview_file))
111-
create_zoom_set_of_smartviews(
112-
context.smview_file,
113-
smartview_name,
114-
)
100+
create_zoom_set_of_smartviews(context.smview_file, smartview_name)
115101

116102
# print(context.skip_all_other_features)
117103
if context.skip_all_other_features["skip"] is True:
@@ -190,11 +176,7 @@ def after_step(context, step):
190176
):
191177
# print("\nDBG: {}, {}\n".format(step.name, context.open_step_counter))
192178
# print(context.falseguids)
193-
add_smartview(
194-
context.smview_file,
195-
step.name,
196-
context.falseguids
197-
)
179+
add_smartview(context.smview_file, step.name, context.falseguids)
198180

199181
# elecount
200182
if hasattr(context, "elemcount"):

src/ifcbimtester/bimtester/run.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import time
2525
import tempfile
2626
import ifcopenshell
27+
2728
try:
2829
import ifcopenshell.express
2930
except:
@@ -34,6 +35,10 @@
3435
from behave.__main__ import main as behave_main
3536

3637

38+
# TODO: refactor when this isn't super experimental
39+
from logging import StreamHandler
40+
41+
3742
class TestRunner:
3843
def __init__(self, ifc_path, schema_path=None, ifc=None, ifcstore=None):
3944

src/ifcbimtester/bimtester/util.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,23 @@ def assert_elements(
143143
if parameter is None:
144144
assert False, (message_all_falseelems.format(elemcount=elemcount, ifc_class=ifc_class) + "\n")
145145
else:
146-
assert False, (
147-
message_all_falseelems.format(elemcount=elemcount, ifc_class=ifc_class, parameter=parameter) + "\n")
146+
assert False, (message_all_falseelems.format(elemcount=elemcount, ifc_class=ifc_class, parameter=parameter) + "\n")
148147
elif falsecount > 0 and falsecount < elemcount:
149148
if parameter is None:
150-
assert False, (
151-
message_some_falseelems.format(falsecount=falsecount, elemcount=elemcount, ifc_class=ifc_class, falseelems=out_falseelems) + "\n")
149+
assert False, (message_some_falseelems.format(
150+
falsecount=falsecount,
151+
elemcount=elemcount,
152+
ifc_class=ifc_class,
153+
falseelems=out_falseelems
154+
) + "\n")
152155
else:
153-
assert False, (
154-
message_some_falseelems.format(falsecount=falsecount, elemcount=elemcount, ifc_class=ifc_class, falseelems=out_falseelems, parameter=parameter) + "\n"
155-
)
156+
assert False, (message_some_falseelems.format(
157+
falsecount=falsecount,
158+
elemcount=elemcount,
159+
ifc_class=ifc_class,
160+
falseelems=out_falseelems,
161+
parameter=parameter
162+
) + "\n")
156163
else:
157164
assert False, _("Error in falsecount calculation, something went wrong.") + "\n"
158165

0 commit comments

Comments
 (0)