Tests: fixed double stop() call for some tests.
This commit is contained in:
@@ -201,6 +201,8 @@ class TestUnit(unittest.TestCase):
|
|||||||
self._print_log()
|
self._print_log()
|
||||||
exit("Could not start unit")
|
exit("Could not start unit")
|
||||||
|
|
||||||
|
self._started = True
|
||||||
|
|
||||||
self.skip_alerts = [
|
self.skip_alerts = [
|
||||||
r'read signalfd\(4\) failed',
|
r'read signalfd\(4\) failed',
|
||||||
r'sendmsg.+failed',
|
r'sendmsg.+failed',
|
||||||
@@ -209,7 +211,7 @@ class TestUnit(unittest.TestCase):
|
|||||||
self.skip_sanitizer = False
|
self.skip_sanitizer = False
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
stop_errs = self.stop()
|
self.stop()
|
||||||
|
|
||||||
# detect errors and failures for current test
|
# detect errors and failures for current test
|
||||||
|
|
||||||
@@ -244,18 +246,21 @@ class TestUnit(unittest.TestCase):
|
|||||||
else:
|
else:
|
||||||
self._print_log()
|
self._print_log()
|
||||||
|
|
||||||
self.assertListEqual(stop_errs, [None, None], 'stop errors')
|
self.assertListEqual(self.stop_errors, [None, None], 'stop errors')
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
errors = []
|
if not self._started:
|
||||||
|
return
|
||||||
|
|
||||||
errors.append(self._stop())
|
self.stop_errors = []
|
||||||
|
|
||||||
errors.append(self.stop_processes())
|
self.stop_errors.append(self._stop())
|
||||||
|
|
||||||
|
self.stop_errors.append(self.stop_processes())
|
||||||
|
|
||||||
atexit.unregister(self.stop)
|
atexit.unregister(self.stop)
|
||||||
|
|
||||||
return errors
|
self._started = False
|
||||||
|
|
||||||
def _stop(self):
|
def _stop(self):
|
||||||
if self._p.poll() is not None:
|
if self._p.poll() is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user