Merge "Better error messages from invalid sample tasks"

This commit is contained in:
Jenkins 2015-08-18 23:59:05 +00:00 committed by Gerrit Code Review
commit ba1db0c4c4

View File

@ -55,8 +55,7 @@ class TaskSampleTestCase(test.TestCase):
eng.validate() eng.validate()
except Exception: except Exception:
print(traceback.format_exc()) print(traceback.format_exc())
self.assertTrue(False, self.fail("Invalid task file: %s" % full_path)
"Wrong task config %s" % full_path)
else: else:
scenarios.update(task_config.keys()) scenarios.update(task_config.keys())
@ -77,7 +76,11 @@ class TaskSampleTestCase(test.TestCase):
continue continue
full_path = os.path.join(dirname, filename) full_path = os.path.join(dirname, filename)
with open(full_path) as task_file: 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): def test_task_config_pair_existance(self):
inexistent_paths = [] inexistent_paths = []