Skip to content
Snippets Groups Projects

Clean up & add unit tests

Merged Davide Fazzini requested to merge dfazzini_unit_tests_configuration into master
2 files
+ 31
46
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -111,6+111,6 @@
testfileDB, if yes it checks if the option is settable.
Args:
- options: list of DaVinci options.
- jobOptFile: file containing the job options chosen by the user.
- fileDB_key: key in the testfileDB.
- fileDB_file: file containing the testfileDB.
- override_data_options: boolean for enabling data options override.
"""
if jobOptFile == '':
log_click("WARNING",
"No jobOption file selected, the default values are used.")
else:
dataOptions = list_data_options(fileDB_key.split(":")[0], fileDB_file)
with open(os.path.expandvars(jobOptFile)) as config_file:
_, ext = os.path.splitext(jobOptFile)
if ext in (".yaml", ".yml", ".json"):
import yaml
config = yaml.safe_load(config_file)
elif ext == '.py':
import ast
config = ast.literal_eval(config_file.read())
else:
raise ValueError(
'JobOption file extension not known! Please use only a .py, .json or .yaml (.yml) file!'
)
for key, value in config.items():
if is_option_settable(options, key, dataOptions, override_data_options):
set_option_value(options, key, value)
dataOptions = list_data_options(fileDB_key.split(":")[0], fileDB_file)
with open(os.path.expandvars(jobOptFile)) as config_file:
_, ext = os.path.splitext(jobOptFile)
if ext in (".yaml", ".yml", ".json"):
import yaml
config = yaml.safe_load(config_file)
elif ext == '.py':
import ast
config = ast.literal_eval(config_file.read())
else:
raise ValueError(
'JobOption file extension not known! Please use only a .py, .json or .yaml (.yml) file!'
)
for key, value in config.items():
if is_option_settable(options, key, dataOptions, override_data_options):
set_option_value(options, key, value)
def set_args_options(options, ctx_args, fileDB_key, fileDB_file, override_data_options):
@@ -229,7 +225,7 @@ def check_options(options):
Args:
- options: list of DaVinci options.
"""
"""
dataType = get_option_value(options, "data_type")
option_checker("data_type", dataType)
Loading