def test_kill_using_shell(self):
"""Test when no process exists."""
child_pid = multiprocessing.Value('i', 0)
setup_done = multiprocessing.Semaphore(0)
args = [child_pid, setup_done]
child = multiprocessing.Process(target=TestHelpers._ignores_sigterm, args=args)
child.start()
self.assertTrue(setup_done.acquire(timeout=1.0))
pid_to_kill = child_pid.value
self.assertTrue(helpers.kill_using_shell(logging.getLogger(), pid_to_kill,
signal=signal.SIGKILL))
child.join() # remove orphan process
self.assertFalse(helpers.kill_using_shell(logging.getLogger(), pid_to_kill,
signal=signal.SIGKILL))
评论列表
文章目录