[testsuite] Improve output in case of errors

use the msg= option of unittest.assertXyz() to improve the error
reporting
v0.27.3
Dan Čermák 7 years ago
parent b6d93558ee
commit 740e4ecad1

@ -506,10 +506,12 @@ def test_run(self):
sep='\n'
)
self.assertFalse(timeout["flag"] and "Timeout reached")
self.assertFalse(timeout["flag"], msg="Timeout reached")
self.compare_stdout(i, command, processed_stdout, stdout)
self.compare_stderr(i, command, processed_stderr, stderr)
self.assertEqual(retval, proc.returncode)
self.assertEqual(
retval, proc.returncode, msg="Return value does not match"
)
class Case(unittest.TestCase):
@ -552,11 +554,15 @@ class Case(unittest.TestCase):
unittest.TestCase. This function can be overridden in a child class to
implement a custom check.
"""
self.assertMultiLineEqual(expected_stdout, got_stdout)
self.assertMultiLineEqual(
expected_stdout, got_stdout, msg="Standard output does not match"
)
def compare_stderr(self, i, command, got_stderr, expected_stderr):
""" Same as compare_stdout only for standard-error. """
self.assertMultiLineEqual(expected_stderr, got_stderr)
self.assertMultiLineEqual(
expected_stderr, got_stderr, msg="Standard error does not match"
)
def expand_variables(self, unexpanded_string):
"""

Loading…
Cancel
Save