Merge branch 'v0.6.0' of github.com:IfcOpenShell/IfcOpenShell into v0.6.0

This commit is contained in:
Dion Moult
2020-11-25 20:17:47 +11:00
+32 -10
View File
@@ -1,11 +1,11 @@
from behave.__main__ import main as behave_main
import behave.formatter.pretty # Needed for pyinstaller to package it import behave.formatter.pretty # Needed for pyinstaller to package it
import os
import sys
import shutil
import webbrowser
import fileinput import fileinput
import os
import shutil
import sys
import tempfile import tempfile
import webbrowser
from behave.__main__ import main as behave_main
# get bimtester source code module path # get bimtester source code module path
@@ -30,7 +30,12 @@ def run_tests(args):
if args["advanced_arguments"]: if args["advanced_arguments"]:
behave_args.extend(args["advanced_arguments"].split()) behave_args.extend(args["advanced_arguments"].split())
elif not args["console"]: 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) behave_main(behave_args)
print("# All tests are finished.") print("# All tests are finished.")
return True return True
@@ -43,7 +48,13 @@ def get_features(args):
if f.endswith(".feature"): if f.endswith(".feature"):
os.remove(os.path.join(features_dir, f)) os.remove(os.path.join(features_dir, f))
if args["feature"]: 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 return True
if os.path.exists("features"): if os.path.exists("features"):
shutil.copytree("features", get_resource_path("features")) shutil.copytree("features", get_resource_path("features"))
@@ -55,7 +66,10 @@ def get_features(args):
if args["feature"] and args["feature"] != f: if args["feature"] and args["feature"] != f:
continue continue
has_features = True 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 return has_features
@@ -66,7 +80,8 @@ def get_features(args):
# on each new run, directory will be deleted before each new run # on each new run, directory will be deleted before each new run
# https://github.com/behave/behave/issues/871 # https://github.com/behave/behave/issues/871
# run bimtester # 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 from behave.runner_util import reset_runtime
reset_runtime() reset_runtime()
@@ -217,11 +232,18 @@ def run_intmp_tests(args={}):
behave_args.extend(args["advanced_arguments"].split()) behave_args.extend(args["advanced_arguments"].split())
elif "console" not in args: elif "console" not in args:
behave_args.extend([ behave_args.extend([
# redirect prints in step methods
# if step fails some output is catched, thus might not be printed
"--no-capture", "--no-capture",
# next two lines are one arg
"--format", "--format",
"json.pretty", "json.pretty",
# next two lines are one arg
"--outfile", "--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) print(behave_args)