def test_update_result_queue_on_failure(self): task = FailTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, FAILED, json.dumps("test failure expl"), [], []))
def test_update_result_queue_on_success(self): task = SuccessTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, DONE, json.dumps("test success expl"), [], None))
def test_update_result_queue_on_success(self): # IMO this test makes no sense as it tests internal behavior and have # already broken once during internal non-changing refactoring class SuccessTask(luigi.Task): def on_success(self): return "test success expl" task = SuccessTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue, lambda: None, lambda: None) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, DONE, "test success expl", [], None))
def test_update_result_queue_on_success(self): # IMO this test makes no sense as it tests internal behavior and have # already broken once during internal non-changing refactoring class SuccessTask(luigi.Task): def on_success(self): return "test success expl" task = SuccessTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue, mock.Mock()) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, DONE, "test success expl", [], None))
def test_update_result_queue_on_failure(self): class FailTask(luigi.Task): def run(self): raise BaseException("Uh oh.") def on_failure(self, exception): return "test failure expl" task = FailTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue) with mock.patch.object(result_queue, "put") as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, FAILED, json.dumps("test failure expl"), [], []))
def test_update_result_queue_on_failure(self): # IMO this test makes no sense as it tests internal behavior and have # already broken once during internal non-changing refactoring class FailTask(luigi.Task): def run(self): raise BaseException("Uh oh.") def on_failure(self, exception): return "test failure expl" task = FailTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue, lambda: None, lambda: None) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, FAILED, "test failure expl", [], []))
def test_update_result_queue_on_failure(self): # IMO this test makes no sense as it tests internal behavior and have # already broken once during internal non-changing refactoring class FailTask(luigi.Task): def run(self): raise BaseException("Uh oh.") def on_failure(self, exception): return "test failure expl" task = FailTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue, mock.Mock()) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with((task.task_id, FAILED, "test failure expl", [], []))
def test_update_result_queue_on_failure(self): class FailTask(luigi.Task): def run(self): raise BaseException("Uh oh.") def on_failure(self, exception): return "test failure expl" task = FailTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with( (task.task_id, FAILED, json.dumps("test failure expl"), [], []))
def test_fail_on_false_complete(self): class NeverCompleteTask(luigi.Task): def complete(self): return False task = NeverCompleteTask() result_queue = multiprocessing.Queue() task_process = TaskProcess(task, 1, result_queue, mock.Mock(), check_complete_on_run=True) with mock.patch.object(result_queue, 'put') as mock_put: task_process.run() mock_put.assert_called_once_with(( task.task_id, FAILED, StringContaining("finished running, but complete() is still returning false"), [], None ))