diff --git a/src/ifcbimtester/run.py b/src/ifcbimtester/run.py index 0673dec275..c64c54372f 100644 --- a/src/ifcbimtester/run.py +++ b/src/ifcbimtester/run.py @@ -1,11 +1,11 @@ -from behave.__main__ import main as behave_main import behave.formatter.pretty # Needed for pyinstaller to package it -import os -import sys -import shutil -import webbrowser import fileinput +import os +import shutil +import sys import tempfile +import webbrowser +from behave.__main__ import main as behave_main # get bimtester source code module path @@ -30,7 +30,12 @@ def run_tests(args): if args["advanced_arguments"]: behave_args.extend(args["advanced_arguments"].split()) elif not args["console"]: - behave_args.extend(["--format", "json.pretty", "--outfile", "report/report.json"]) + behave_args.extend([ + "--format", + "json.pretty", + "--outfile", + "report/report.json" + ]) behave_main(behave_args) print("# All tests are finished.") return True @@ -43,7 +48,13 @@ def get_features(args): if f.endswith(".feature"): os.remove(os.path.join(features_dir, f)) if args["feature"]: - shutil.copyfile(args["feature"], os.path.join(get_resource_path("features"), os.path.basename(args["feature"]))) + shutil.copyfile( + args["feature"], + os.path.join( + get_resource_path("features"), + os.path.basename(args["feature"]) + ) + ) return True if os.path.exists("features"): shutil.copytree("features", get_resource_path("features")) @@ -55,7 +66,10 @@ def get_features(args): if args["feature"] and args["feature"] != f: continue has_features = True - shutil.copyfile(f, os.path.join(get_resource_path("features"), os.path.basename(f))) + shutil.copyfile( + f, + os.path.join(get_resource_path("features"), os.path.basename(f)) + ) return has_features @@ -66,7 +80,8 @@ def get_features(args): # on each new run, directory will be deleted before each new run # https://github.com/behave/behave/issues/871 # run bimtester -# copy manually this code, run bimtester again, does not work on two directories +# copy manually this code, run bimtester again, +# does not work on two directories from behave.runner_util import reset_runtime reset_runtime() @@ -217,11 +232,18 @@ def run_intmp_tests(args={}): behave_args.extend(args["advanced_arguments"].split()) elif "console" not in args: behave_args.extend([ + # redirect prints in step methods + # if step fails some output is catched, thus might not be printed "--no-capture", + # next two lines are one arg "--format", "json.pretty", + # next two lines are one arg "--outfile", - os.path.join(report_path, "report.json") + os.path.join(report_path, "report.json"), + # next two lines are one arg + "--define", + "ifcbasename={}".format(os.path.splitext(ifc_filename)[0]) ]) print(behave_args)