Files
IfcOpenShell/src/ifcbimtester/bimtester/features/environment.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.8 KiB
Python
Raw Normal View History

import os
2019-10-15 11:58:26 +11:00
from behave.model import Scenario
2020-11-01 19:22:49 +07:00
from logfile import create_logfile
from logfile import append_logfile
from zoom_smart_view import append_zoom_smartview
from zoom_smart_view import create_zoom_smartview
this_path = os.path.dirname(os.path.realpath(__file__))
2020-11-01 19:22:49 +07:00
2019-10-15 11:58:26 +11:00
def before_all(context):
# get from userdata
2019-10-15 11:58:26 +11:00
userdata = context.config.userdata
2020-12-21 10:28:03 +01:00
context.ifcbasename = userdata["ifcbasename"]
2020-12-18 16:12:11 +01:00
context.localedir = userdata.get("localedir")
2020-12-21 10:28:03 +01:00
# do not break after a failed scenario
# https://community.osarch.org/discussion/comment/3328/#Comment_3328
continue_after_failed = userdata.getbool(
"runner.continue_after_failed_step", True
)
2019-10-15 11:58:26 +11:00
Scenario.continue_after_failed_step = continue_after_failed
# keep out path
context.outpath = os.path.join(this_path, "..")
# since bimtesterfc directory in tmp is removed on every run
# neither log file nor sm file does need to be explicit removed first
# set up log file
context.thelogfile = os.path.join(
context.outpath,
context.ifcbasename + ".log"
)
create_logfile(
context.thelogfile,
context.ifcbasename,
)
# set up smart view file
context.smview_file = os.path.join(
context.outpath,
context.ifcbasename + ".bcsv"
)
create_zoom_smartview(
context.smview_file,
context.ifcbasename,
)
def after_step(context, step):
if step.status == "failed":
# append log file
append_logfile(context, step)
# extend smart view
if hasattr(context, "falseguids"):
# print(context.falseguids)
append_zoom_smartview(
context.smview_file,
step.name,
context.falseguids
)