bimtester: run, improve method run copy in temp

This commit is contained in:
Bernd Hahnebach
2021-01-12 10:40:23 +01:00
parent aa82cb15d2
commit addf28c1e2
+42 -12
View File
@@ -118,6 +118,9 @@ def run_copyintmp_tests(args={}):
advanced_arguments: optional advanced_arguments: optional
they will be directly passed to the behave call they will be directly passed to the behave call
the following differentiation has to be made here because the decision
if the ifc file path in the feature file will be changed or not
features and ifcfile are given: features and ifcfile are given:
the ifcfile in feature files is replaced the ifcfile in feature files is replaced
@@ -144,22 +147,29 @@ def run_copyintmp_tests(args={}):
) )
return False return False
# get the features_path, the dir where the feature files to test are in if ("features" in args and args["features"] != ""):
if "features" in args and args["features"] != "": is_features = True
else:
is_features = False
if ("ifcfile" in args and args["ifcfile"] != ""):
is_ifcfile = True
else:
is_ifcfile = False
if is_features is True and is_ifcfile is True:
# features and ifcfile are given:
# the ifcfile in feature files is replaced
# get the features_path, the dir where the feature files to test are in
the_features_path = os.path.join(args["features"], "features") the_features_path = os.path.join(args["features"], "features")
if not os.path.isdir(the_features_path): if not os.path.isdir(the_features_path):
print( print(
"The features directory does not exist: {}" "Error, the features directory '{}' does not exist."
.format(the_features_path) .format(the_features_path)
) )
return False return False
else:
# TODO assume features beside ifc thus use ifc path
print("No features path was given.")
return False
# get ifc path and ifc filename # get ifc path and ifc filename
if "ifcfile" in args and args["ifcfile"] != "":
ifcfile = args["ifcfile"] ifcfile = args["ifcfile"]
ifc_path = os.path.dirname(os.path.realpath(ifcfile)) ifc_path = os.path.dirname(os.path.realpath(ifcfile))
if os.path.isdir(ifc_path) is False: if os.path.isdir(ifc_path) is False:
@@ -168,11 +178,31 @@ def run_copyintmp_tests(args={}):
if os.path.isfile(ifcfile) is True: if os.path.isfile(ifcfile) is True:
ifc_filename = os.path.basename(ifcfile) ifc_filename = os.path.basename(ifcfile)
else: else:
print("ifc file '{}' does not exist.".format(ifcfile)) print("Error, the ifc file '{}' does not exist.".format(ifcfile))
return False return False
elif is_features is False and is_ifcfile is True:
# ifcfile only is given (TODO):
# features = ifcfile directory
# the ifcfile in feature files is replaced
print("Not yet implemented: features was NOT given, ifcfile was given.")
return False
elif is_features is True and is_ifcfile is False:
# features only is given (TODO):
# the ifcfile provided in the feature files is used
print("Not yet implemented: features was given, ifcfile was NOT given.")
return False
elif is_features is False and is_ifcfile is False:
# none of both is given (TODO):
# the current directory = features
# the ifcfile provided in the feature files is used
print("Not yet implemented: features NOT was given, ifcfile was NOT given.")
return False
else: else:
# TODO use ifc path from feature files print("Error: this should never happen, please debug.")
print("No ifc file was given.")
return False return False
# set up paths # set up paths