Ensure all AutoservRunErrors are constructed with a tuple of two objects, as expected. Also change AutoservRunError's docstring to reflect this requirement. Fixed up some formatting in run_grep while I was at it.
From: Steve Howard <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1168 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index 720cb9c..2559dd3 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -34,8 +34,15 @@
"""Indicates an error which terminates and fails the test."""
pass
+
class CmdError(TestError):
- """Indicates that a command failed, is fatal to the test unless caught."""
+ """\
+ Indicates that a command failed, is fatal to the test unless caught.
+ """
+ def __init__(self, command, result_code):
+ TestError.__init__(self, command, result_code)
+
+
def __str__(self):
return "Command <" + self.args[0] + "> failed, rc=%d" % (self.args[1])
@@ -60,8 +67,13 @@
class AutoservRunError(AutoservError):
- """Errors raised by one of the run functions"""
- pass
+ """\
+ Errors raised by one of the run functions. Should always be
+ constructed with a tuple of two args (error description (str),
+ run result object).
+ """
+ def __init__(self, description, result_obj):
+ AutoservError.__init__(self, description, result_obj)
class AutoservVirtError(AutoservError):