]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Fix errors in functional test error path handling
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 7 Oct 2019 20:42:21 +0000 (14:42 -0600)
committerDhaval Giani <dhaval.giani@oracle.com>
Tue, 8 Oct 2019 17:51:22 +0000 (10:51 -0700)
The RunError() exception class had two bugs that prevented
it from properly formatting a run exception:
    1) It wasn't being created properly due to a misplaced
       parenthesis
    2) It had a syntax error in its __str__() method where
       it was using self.message rather than self.command

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
tests/ftests/run.py

index 80e5221383cb1fee305bf5103abd49af5b9eceb1..0b4e06840c74abfe961b6e29acbba8f408ec85a4 100644 (file)
@@ -54,8 +54,8 @@ class Run(object):
                 ''.join(command), ret, out, err))
 
         if ret != 0:
-            raise RunError("Command '{}' failed".format(''.join(command),
-                           command, ret, out, err))
+            raise RunError("Command '{}' failed".format(''.join(command)),
+                           command, ret, out, err)
 
         return out
 
@@ -69,6 +69,7 @@ class RunError(Exception):
         self.stderr = stderr
 
     def __str__(self):
-        out_str = "RunError:\n\tmessage = {}\n\tret = {}".format(self.message, self.ret)
+        out_str = "RunError:\n\tcommand = {}\n\tret = {}".format(
+                  self.command, self.ret)
         out_str += "\n\tstdout = {}\n\tstderr = {}".format(self.stdout, self.stderr)
         return out_str