Ejemplo n.º 1
0
def test_started_time_with_completed_attempts():
    task_created_time = datetime.datetime(2018, 1, 15, 12, 35, 0)
    task = Task("1234", "some cmd", task_created_time, max_attempts=2)
    attempt_time = datetime.datetime(2018, 1, 15, 12, 35, 30)
    attempt = task.attempt_task("runner 1", attempt_time)
    attempt_completed_time = datetime.datetime(2018, 1, 15, 12, 35, 45)
    attempt.mark_completed(attempt_completed_time)
    attempt_time_2 = datetime.datetime(2018, 1, 15, 12, 35, 45)
    attempt_2 = task.attempt_task("runner 2", attempt_time_2)
    attempt_2.mark_completed(datetime.datetime(2018, 1, 15, 12, 35, 48))
    assert task.started_time() == attempt_time
Ejemplo n.º 2
0
def test_started_time_open_attempt():
    task_created_time = datetime.datetime(2018, 1, 15, 12, 35, 0)
    task = Task("1234", "some cmd", task_created_time, max_attempts=2)
    attempt_time = datetime.datetime(2018, 1, 15, 12, 35, 30)
    task.attempt_task("runner 1", attempt_time)
    assert task.started_time() == attempt_time
Ejemplo n.º 3
0
def test_started_time_new_task():
    task_created_time = datetime.datetime(2018, 1, 15, 12, 35, 0)
    task = Task("1234", "some cmd", task_created_time, max_attempts=2)
    assert task.started_time() is None