diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2018-11-13 18:56:18 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2018-11-13 18:56:18 +0300 |
commit | cf1f84b67c50156dc371e834bbdfd49c105abb25 (patch) | |
tree | 6d622bcd86e9a5e1b3c80e794e4e0de9eb1c692b | |
parent | 4d7f708b258e9fb4280883b4f64700367dcbb40d (diff) | |
download | unit-cf1f84b67c50156dc371e834bbdfd49c105abb25.tar.gz unit-cf1f84b67c50156dc371e834bbdfd49c105abb25.tar.bz2 |
Tests: print path to unit.log file when it was saved.
Diffstat (limited to '')
-rw-r--r-- | test/unit.py | 17 |
1 files 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): |