def test_exited_unreaped_child_of_current_process_is_a_zombie( self) -> None: with subprocess.Popen(["true"]) as process: # Wait for the process to finish, but don't reap it yet. time.sleep(1) self.assertTrue(is_zombie_process(process.pid))
def is_zombie() -> typing.Optional[bool]: return True if is_zombie_process(process.pid) else None
def test_running_child_of_current_process_is_not_a_zombie(self) -> None: process = subprocess.Popen(["sleep", "3"]) self.assertFalse(is_zombie_process(process.pid))
def test_dead_process_is_not_a_zombie(self) -> None: with subprocess.Popen(["true"]) as process: process.wait() self.assertFalse(is_zombie_process(process.pid))
def test_init_process_is_not_a_zombie(self) -> None: self.assertFalse(is_zombie_process(1))