def test_is_in_process_open_attempt(): task = Task("1234", "some cmd", datetime.datetime(2018, 1, 15, 12, 35, 0), max_attempts=2) attempt_time = datetime.datetime(2018, 1, 15, 12, 35, 30) task.attempt_task("runner 1", attempt_time) assert task.is_in_process() is True
def test_is_in_process_one_fail(): task = Task("1234", "some cmd", datetime.datetime(2018, 1, 15, 12, 35, 0), max_attempts=2) attempt_time = datetime.datetime(2018, 1, 15, 12, 35, 30) attempt = task.attempt_task("runner 1", attempt_time) attempt.mark_failed(datetime.datetime(2018, 1, 15, 12, 35, 45)) assert task.is_in_process() is True
def test_is_in_process_no_attempts(): task = Task("1234", "some cmd", datetime.datetime(2018, 1, 15, 12, 35, 0), max_attempts=2) assert task.is_in_process() is False