def test_fetch_fork_result(self): global_log_setup() sleep_arg = '1' results = fork_in_bg(sleep_fn, sleep_arg) expected = fetch_fork_result(results['r'], results['pid']) self.assertEqual(expected, sleep_arg) global_log_cleanup()
def test_wait_for_pids(self): global_log_setup() pid_list = [] for i in range(1, 5): pid_list.append(fork_in_bg(sleep_fn, 10)) wait_for_pids(pid_list) global_log_cleanup()
def test_fetch_ready_fork_result_list(self): global_log_setup() pipe_ids = {} expected = {} svl = 10 for key in range(1, 5): pipe_ids[key] = fork_in_bg(sleep_fn, svl) expected[key] = str(svl) result = fetch_ready_fork_result_list(pipe_ids) self.assertTrue(expected, result) global_log_cleanup()
def test_fetch_fork_result_list(self): global_log_setup() pipe_ids = {} expected = {} svl = 10 for key in range(1, 5): pipe_ids[key] = fork_in_bg(sleep_fn, svl) expected[key] = str(svl) result = fetch_fork_result_list(pipe_ids) self.assertTrue(expected, result) global_log_cleanup()
def test_fork_in_bg(self): global_log_setup() results = fork_in_bg(sleep_fn, 1) self.assertTrue('r' in results) self.assertTrue('pid' in results) global_log_cleanup()