Added psutil's wait process condition on the tearDownClass method

This commit is contained in:
jai.s 2020-10-14 14:14:23 +05:30
parent 14b6202923
commit 978d8cfa07
No known key found for this signature in database
GPG Key ID: 360CFA25EFC67D12

View File

@ -100,10 +100,17 @@ class TestProcessProto(unittest.TestCase):
print('is ever called tearDownC') print('is ever called tearDownC')
if not cls._stop_process(): if not cls._stop_process():
cls.process.kill() cls.process.kill()
logger.error('***********************') gone, alive = psutil.wait_procs(cls.process, timeout = 3,
logger.error('tearDownClass are successfully killed') callback = None)
logger.error('***********************') for p in alive:
p.kill()
print('***********************')
print('tearDownClass are successfully killed')
print('***********************')
except (psutil.NoSuchProcess, FileNotFoundError, AttributeError) as e: except (psutil.NoSuchProcess, FileNotFoundError, AttributeError) as e:
print('################################')
print('TearDownClass except section')
print('################################')
pass pass
finally: finally:
cls._cleanup_files() cls._cleanup_files()