From 5c13660f1e10d2f47ccf4cfe339431e7a94af230 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Thu, 18 Mar 2021 16:50:53 +0000 Subject: [PATCH] Add optional parameter forgive=False to reportTest() for use by nls_test to avoid false fails. --- tests/bash_tests/testcases.py | 2 +- tests/bash_tests/utils.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/bash_tests/testcases.py b/tests/bash_tests/testcases.py index 951fb31b..e0cf3a38 100644 --- a/tests/bash_tests/testcases.py +++ b/tests/bash_tests/testcases.py @@ -898,7 +898,7 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 for language in ['fr_FR', 'es_ES']: e = BT.Executer(cmd='exiv2', extra_env={'LC_ALL': language, LANG: language}, assert_returncode=[1], decode_output=False) out += e.stdout.split(b'\n')[0].decode() - BT.reportTest('nls-test', out) + BT.reportTest('nls-test', out,forgive=True) def path_test(self): diff --git a/tests/bash_tests/utils.py b/tests/bash_tests/utils.py index 0f280c59..98053907 100644 --- a/tests/bash_tests/utils.py +++ b/tests/bash_tests/utils.py @@ -546,7 +546,7 @@ class Output: return self.__add__(other) -def reportTest(testname, output: str, encoding=None): +def reportTest(testname, output: str, encoding=None,forgive=False): """ If the output of the test case is correct, this function returns None. Otherwise print its error. """ output = str(output) + '\n' encoding = encoding or Config.encoding @@ -559,7 +559,10 @@ def reportTest(testname, output: str, encoding=None): save(output, output_file, encoding=encoding) log.info('The output has been saved to file {}'.format(output_file)) log.info('simply_diff:\n' + str(simply_diff(reference_file, output_file, encoding=encoding))) - raise RuntimeError('\n' + log.to_str()) + if forgive: + print('Forgive: simply_diff:\n' + str(simply_diff(reference_file, output_file, encoding=encoding))) + else: + raise RuntimeError('\n' + log.to_str()) def ioTest(filename):