issue #482: tests: check for zombie process after test.

This commit is contained in:
David Wilson 2019-03-14 19:31:39 +00:00
parent 3a1125a7bd
commit 9c38093aa7
1 changed files with 13 additions and 0 deletions

View File

@ -341,7 +341,20 @@ class TestCase(unittest2.TestCase):
self, self._fd_count_before, get_fd_count(),
)
def _teardown_check_zombies(self):
try:
pid, status, ru = os.wait3(os.WNOHANG)
except OSError:
return # ECHILD
if pid:
assert 0, "%s failed to reap subprocess %d (status %d)." % (
self, pid, status
)
assert 0, "%s leaked still-running subprocesses." % (self,)
def tearDown(self):
self._teardown_check_zombies()
self._teardown_check_threads()
self._teardown_check_fds()
super(TestCase, self).tearDown()