pavilion2
pavilion2 copied to clipboard
Template Errors not being printed bug
I was having problems with templates not being created. I kept getting this error:
me@machine: ~/repo/pavilion2/examples/tutorials> pav run umt
Error making tests for series 's68'.
Error creating test 'umt.base' in test set 'cmd_line'
Error resolving Build template files
After diving into the pavilion code, I learned:
- That my template file was named incorrectly.
- One of the variables wasn't set in my test config. Both of these errors would result in that error.
Looking at the create_files.py within the lib/pavilion dir, its supposed to print the error but it doesn't seem like it does.
def resolve_template(pav_cfg: pavilion.config.PavConfig, template: str,
var_man: variables.VariableSetManager) -> List[str]:
"""Resolve each of the template files specified in the test config."""
tmpl_path = pav_cfg.find_file(Path(template), 'test_src')
if tmpl_path is None:
raise TestConfigError("Template file '{}' from 'templates' does not exist in "
"any 'test_src' dir (Note that it must be in a Pavilion config "
"area's test_src directory - NOT the build directory.)"
.format(template))
try:
with tmpl_path.open() as tmpl_file:
tmpl_lines = tmpl_file.readlines()
except OSError as err:
raise TestConfigError("Error reading template file '{}'".format(tmpl_path), err)
try:
return resolve.section_values(tmpl_lines, var_man)
except TestConfigError as err:
raise TestConfigError("Error resolving template '{}'"
.format(tmpl_path), err)
lib/pavilion/errors.py needs to be updated so the errors can be printed.
Feel like this could be related to #585