From cf1f84b67c50156dc371e834bbdfd49c105abb25 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Tue, 13 Nov 2018 18:56:18 +0300 Subject: [PATCH] Tests: print path to unit.log file when it was saved. --- test/unit.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/unit.py b/test/unit.py index edfa39a0..a5f96968 100644 --- a/test/unit.py +++ b/test/unit.py @@ -52,6 +52,9 @@ class TestUnit(unittest.TestCase): if '--leave' not in sys.argv and success: shutil.rmtree(self.testdir) + else: + self._print_path_to_log() + def check_modules(self, *modules): self._run() @@ -191,11 +194,16 @@ class TestUnit(unittest.TestCase): for skip in self.skip_alerts: alerts = [al for al in alerts if re.search(skip, al) is None] - self.assertFalse(alerts, 'alert(s)') + if alerts: + self._print_path_to_log() + self.assertFalse(alerts, 'alert(s)') if not self.skip_sanitizer: - self.assertFalse(re.findall('.+Sanitizer.+', log), - 'sanitizer error(s)') + sanitizer_errors = re.findall('.+Sanitizer.+', log) + + if sanitizer_errors: + self._print_path_to_log() + self.assertFalse(sanitizer_error, 'sanitizer error(s)') if found: print('skipped.') @@ -219,6 +227,9 @@ class TestUnit(unittest.TestCase): return ret + def _print_path_to_log(self): + print('Path to unit.log:\n' + self.testdir + '/unit.log') + class TestUnitHTTP(TestUnit): def http(self, start_str, **kwargs):