提交 d0199956 编写于 作者: L Lukáš Doktor

avocado.core.tree: Improve error message on missing !include file

When a multiplex file includes a missing file, avocado only reports
"there is a missing file" without any explanations whatsoever. This
patch changes it to a ValueError with the original file and the
missing one.

Additionally it adds missing Exception to try/except, which was
already possible on certain errors, to avoid tracebacks.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 675681f6
...@@ -461,8 +461,8 @@ class Job(object): ...@@ -461,8 +461,8 @@ class Job(object):
try: try:
mux = multiplexer.Mux(self.args) mux = multiplexer.Mux(self.args)
except IOError, details: except (IOError, ValueError), details:
raise exceptions.OptionValidationError(details.strerror) raise exceptions.OptionValidationError(details)
self.args.test_result_total = mux.get_number_of_tests(test_suite) self.args.test_result_total = mux.get_number_of_tests(test_suite)
self._make_test_result() self._make_test_result()
......
...@@ -333,6 +333,9 @@ def _create_from_yaml(path, cls_node=TreeNode): ...@@ -333,6 +333,9 @@ def _create_from_yaml(path, cls_node=TreeNode):
ypath = value[1] ypath = value[1]
if not os.path.isabs(ypath): if not os.path.isabs(ypath):
ypath = os.path.join(os.path.dirname(path), ypath) ypath = os.path.join(os.path.dirname(path), ypath)
if not os.path.exists(ypath):
raise ValueError("File '%s' included from '%s' does not "
"exist." % (ypath, path))
node.merge(_create_from_yaml('/:' + ypath, cls_node)) node.merge(_create_from_yaml('/:' + ypath, cls_node))
elif value[0].code == YAML_USING: elif value[0].code == YAML_USING:
if using: if using:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册