diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2020-07-28 04:53:32 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2020-07-28 04:53:32 +0100 |
commit | 355ed9697d10f163f4b96bc459f9c402aefa5d55 (patch) | |
tree | 244fcf734bb7157f8fac63fd12c2de400372f7ca | |
parent | dc1377dc489937abcc6a5d0dcbfa628e0e6bdf1c (diff) | |
download | unit-355ed9697d10f163f4b96bc459f9c402aefa5d55.tar.gz unit-355ed9697d10f163f4b96bc459f9c402aefa5d55.tar.bz2 |
Tests: fixed double stop() call for some tests.
-rw-r--r-- | test/unit/main.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/unit/main.py b/test/unit/main.py index 253ddc71..83aa9139 100644 --- a/test/unit/main.py +++ b/test/unit/main.py @@ -201,6 +201,8 @@ class TestUnit(unittest.TestCase): self._print_log() exit("Could not start unit") + self._started = True + self.skip_alerts = [ r'read signalfd\(4\) failed', r'sendmsg.+failed', @@ -209,7 +211,7 @@ class TestUnit(unittest.TestCase): self.skip_sanitizer = False def tearDown(self): - stop_errs = self.stop() + self.stop() # detect errors and failures for current test @@ -244,18 +246,21 @@ class TestUnit(unittest.TestCase): else: self._print_log() - self.assertListEqual(stop_errs, [None, None], 'stop errors') + self.assertListEqual(self.stop_errors, [None, None], 'stop errors') def stop(self): - errors = [] + if not self._started: + return + + self.stop_errors = [] - errors.append(self._stop()) + self.stop_errors.append(self._stop()) - errors.append(self.stop_processes()) + self.stop_errors.append(self.stop_processes()) atexit.unregister(self.stop) - return errors + self._started = False def _stop(self): if self._p.poll() is not None: |