Better error messages from invalid sample tasks
An invalid sample JSON task file gave an error message that didn't give the filename. This commit fixes that, and does some minor cleanup around invalid YAML tasks. Change-Id: I21f38e015e310a6450286f700c634ebd03eec5be
This commit is contained in:
parent
12b1abd86d
commit
63f7258f0a
@ -55,8 +55,7 @@ class TaskSampleTestCase(test.TestCase):
|
||||
eng.validate()
|
||||
except Exception:
|
||||
print(traceback.format_exc())
|
||||
self.assertTrue(False,
|
||||
"Wrong task config %s" % full_path)
|
||||
self.fail("Invalid task file: %s" % full_path)
|
||||
else:
|
||||
scenarios.update(task_config.keys())
|
||||
|
||||
@ -77,7 +76,11 @@ class TaskSampleTestCase(test.TestCase):
|
||||
continue
|
||||
full_path = os.path.join(dirname, filename)
|
||||
with open(full_path) as task_file:
|
||||
json.load(task_file)
|
||||
try:
|
||||
json.load(task_file)
|
||||
except Exception:
|
||||
print(traceback.format_exc())
|
||||
self.fail("Invalid JSON file: %s" % full_path)
|
||||
|
||||
def test_task_config_pair_existance(self):
|
||||
inexistent_paths = []
|
||||
|
Loading…
Reference in New Issue
Block a user