From: Tom Hromatka Date: Mon, 7 Oct 2019 20:42:21 +0000 (-0600) Subject: tests: Fix errors in functional test error path handling X-Git-Tag: v0.42.rc1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2dd1abbfbf15493aeb1aaf77d9aaae978f3c12;p=thirdparty%2Flibcgroup.git tests: Fix errors in functional test error path handling 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 Signed-off-by: Dhaval Giani --- diff --git a/tests/ftests/run.py b/tests/ftests/run.py index 80e52213..0b4e0684 100644 --- a/tests/ftests/run.py +++ b/tests/ftests/run.py @@ -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