def test_start(self):
"""
Verifies that pidfile is created, process exists, pidfile is not empty.
"""
result = os.system(self.cmd % (THIS_FILE_PATH, 'start', self.pidfile))
sleep(1)
self.assertTrue(os.path.exists(self.pidfile),
'Pidfile has not been created')
with open(self.pidfile) as pid_file:
pid = pid_file.read().rstrip()
self.assertTrue(pid, 'Pidfile is empty')
self.assertTrue(psutil.pid_exists(int(pid)),
'Process with specified pid does not exist')
self.assertEqual(result, 0, 'Wrong return code')
评论列表
文章目录