def setup_task_state(mock_datetime_now, logs:List[Tuple[str, str]], time_after=None, task=None, session=None):
    """A mock up that sets up a task to test the
    condition with given logs

    Parameters
    ----------
    tmpdir : Pytest fixture
    mock_datetime_now : Pytest fixture
    logs : list of tuples
        Logs to be inserted for the task.
        The tuple is in form (datetime, action)
    time_after : date-like
        The datetime when inspecting the condition status
    """
    if task is None:
        task = FuncTask(
            lambda:None,
            name="the task",
            execution="main",
            session=session
        )

    for log in logs:
        log_time, log_action = log[0], log[1]
        record = create_task_record(
            created=log_time, action=log_action, task_name="the task",
            # The content here should not matter for task status
            pathname='rocketry\\rocketry\\core\\task\\base.py',
            msg="Logging of 'task'", args=(), exc_info=None,
        )

        task.logger.handle(record)

    if time_after is not None:
        mock_datetime_now(time_after)
    return task
A mock up that sets up a task to test the
condition with given logs

Parameters
----------
tmpdir : Pytest fixture
mock_datetime_now : Pytest fixture
logs : list of tuples
Logs to be inserted for the task.
The tuple is in form (datetime, action)
time_after : date-like
The datetime when inspecting the condition status
rocketry/test/condition/task/test_time.py