From d672220f05ecd77beeaab90042f3dd31def0a102 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sat, 25 Feb 2017 20:41:16 -0800 Subject: Added ability for must_match to pass message to be output if it fails --- QMTest/TestCommon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py index 9093cc9..cd9e990 100644 --- a/QMTest/TestCommon.py +++ b/QMTest/TestCommon.py @@ -469,7 +469,7 @@ class TestCommon(TestCmd): print("Missing one of: `%s'" % "', `".join(missing)) self.fail_test(missing) - def must_match(self, file, expect, mode = 'rb', match=None): + def must_match(self, file, expect, mode = 'rb', match=None, message=None): """Matches the contents of the specified file (first argument) against the expected contents (second argument). The expected contents are a list of lines or a string which will be split @@ -479,7 +479,7 @@ class TestCommon(TestCmd): if not match: match = self.match try: - self.fail_test(not match(to_str(file_contents), to_str(expect))) + self.fail_test(not match(to_str(file_contents), to_str(expect)), message=message) except KeyboardInterrupt: raise except: -- cgit v0.12