Removed the psutil.wait_procs and added process wait in teardownclass
This commit is contained in:
parent
567492b9f6
commit
3539de081d
|
@ -59,35 +59,17 @@ class TestProcessProto(unittest.TestCase):
|
||||||
def _stop_process(cls, timeout=120):
|
def _stop_process(cls, timeout=120):
|
||||||
cls.process.send_signal(signal.SIGTERM)
|
cls.process.send_signal(signal.SIGTERM)
|
||||||
try:
|
try:
|
||||||
|
print('1111111111111111111111111111111111111111')
|
||||||
|
print('In the _stop_process_ method ,after the term signal wait process are started')
|
||||||
|
print('1111111111111111111111111111111111111111')
|
||||||
cls.process.wait(timeout)
|
cls.process.wait(timeout)
|
||||||
try:
|
print('222222222222222222222222222222222222')
|
||||||
print('55555555555555555')
|
print('In the _stop_process_ method ,wait process are completed')
|
||||||
print('psutil.pid_exists(cls.process.pid)-{}'.format(
|
print('222222222222222222222222222222222222')
|
||||||
psutil.pid_exists(cls.process.pid)))
|
|
||||||
print('55555555555555555')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
logger.error('_stop_process')
|
|
||||||
logger.error('this condition are getting killed are not')
|
|
||||||
print('psutil.pid_exists(cls.process.pid)-{}'.format(
|
|
||||||
psutil.pid_exists(cls.process.pid)))
|
|
||||||
print('psutil.pid-{}'.format(cls.process.pid))
|
|
||||||
logger.error('__stop__process')
|
|
||||||
except psutil.TimeoutExpired:
|
except psutil.TimeoutExpired:
|
||||||
print('#####_stop_process method condition--##')
|
print('33333333333333333333333333333333')
|
||||||
try:
|
print('In the _stop_process_ method ,psutil.timoutExpired is occured')
|
||||||
gone, alive = psutil.wait_procs(cls.process, timeout = 3,
|
print('33333333333333333333333333333333')
|
||||||
callback = None)
|
|
||||||
for p in alive:
|
|
||||||
p.kill()
|
|
||||||
print('***********************')
|
|
||||||
print('tearDownClass are successfully killed')
|
|
||||||
print('***********************')
|
|
||||||
print('cls.process PID -{}'.format(cls.process.pid))
|
|
||||||
except:
|
|
||||||
print('cls.process -{}'.format(cls.process))
|
|
||||||
|
|
||||||
print('#####_stop_process method condition--##')
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -104,20 +86,22 @@ class TestProcessProto(unittest.TestCase):
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
"""Ensures that pybitmessage stopped and removes files"""
|
"""Ensures that pybitmessage stopped and removes files"""
|
||||||
try:
|
try:
|
||||||
print('is ever called tearDownC')
|
|
||||||
if not cls._stop_process():
|
if not cls._stop_process():
|
||||||
|
print('444444444444444444444444444444')
|
||||||
|
print('In the tearDownClass ,initiating the process Killing')
|
||||||
|
print('44444444444444444444444444444')
|
||||||
cls.process.kill()
|
cls.process.kill()
|
||||||
gone, alive = psutil.wait_procs(cls.process, timeout = 3,
|
print('5555555555555555555555555555555')
|
||||||
callback = None)
|
print('In the tearDownClass ,initiating the process wait')
|
||||||
for p in alive:
|
print('55555555555555555555555555555')
|
||||||
p.kill()
|
cls.process.wait(5)
|
||||||
print('***********************')
|
print('6666666666666666666666666666')
|
||||||
print('tearDownClass are successfully killed')
|
print('In the tearDownClass ,Process killied ?')
|
||||||
print('***********************')
|
print('666666666666666666666666666666')
|
||||||
except (psutil.NoSuchProcess, FileNotFoundError, AttributeError) as e:
|
except (psutil.NoSuchProcess, psutil.TimeoutExpired ,FileNotFoundError, AttributeError) as e:
|
||||||
print('################################')
|
print('77777777777777777777777777')
|
||||||
print('TearDownClass except section')
|
print('In the tearDownClass ,after sending the kill process are not stopped')
|
||||||
print('################################')
|
print('77777777777777777777777777')
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
cls._cleanup_files()
|
cls._cleanup_files()
|
||||||
|
|
Reference in New Issue
Block a user