Example #1
0
def test_task_redo2():
    """Test that `.redo()` raises if called on a Task that is not TERMINATED."""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.submit()
        assert task.execution.state == Run.State.SUBMITTED

        # cannot redo a task that is not yet terminated
        task.redo()
Example #2
0
def test_engine_redo_Task2():
    """Test that `Engine.redo()` raises if called on a Task that is not TERMINATED."""
    with temporary_engine() as engine:
        task = SuccessfulApp()
        engine.add(task)

        engine.progress()
        assert task.execution.state != Run.State.NEW

        # cannot redo a task that is not yet terminated
        task.redo()
Example #3
0
def test_task_redo2():
    """Test that `.redo()` raises if called on a Task that is not TERMINATED."""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.submit()
        assert task.execution.state == Run.State.SUBMITTED

        # cannot redo a task that is not yet terminated
        with pytest.raises(AssertionError):
            task.redo()
            pytest.fail("`Task.redo()` succeeded on task not yet finished")
Example #4
0
def test_task_redo2():
    """Test that `.redo()` raises if called on a Task that is not TERMINATED."""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.submit()
        assert task.execution.state == Run.State.SUBMITTED

        # cannot redo a task that is not yet terminated
        with pytest.raises(AssertionError,
                   message="`Task.redo()` succeeded on task not yet finished"):
            task.redo()
Example #5
0
def test_engine_redo_Task2():
    """Test that `Engine.redo()` raises if called on a Task that is not TERMINATED."""
    with temporary_engine() as engine:
        task = SuccessfulApp()
        engine.add(task)

        engine.progress()
        assert task.execution.state != Run.State.NEW

        # cannot redo a task that is not yet terminated
        with pytest.raises(AssertionError):
            task.redo()
            pytest.fail("`Task.redo()` succeeded on task not yet finished")
Example #6
0
def test_task_redo1():
    """Test correct use of `Task.redo()`"""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.submit()
        assert task.execution.state == Run.State.SUBMITTED

        # run until terminated
        while task.execution.state != Run.State.TERMINATED:
            task.progress()
        assert task.execution.state == Run.State.TERMINATED

        # no do it all over again
        task.redo()
        assert task.execution.state == Run.State.NEW

        task.progress()
        assert task.execution.state != Run.State.NEW
        assert task.execution.state in [Run.State.SUBMITTED, Run.State.RUNNING]
Example #7
0
def test_task_redo1():
    """Test correct use of `Task.redo()`"""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.submit()
        assert task.execution.state == Run.State.SUBMITTED

        # run until terminated
        while task.execution.state != Run.State.TERMINATED:
            task.progress()
        assert task.execution.state == Run.State.TERMINATED

        # no do it all over again
        task.redo()
        assert task.execution.state == Run.State.NEW

        task.progress()
        assert task.execution.state != Run.State.NEW
        assert task.execution.state in [Run.State.SUBMITTED, Run.State.RUNNING]
Example #8
0
def test_task_redo3():
    """Test that `.redo()` is a no-op if the Task is still NEW."""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.redo()
Example #9
0
def test_engine_redo_Task3():
    """Test that `Engine.redo()` is a no-op if the Task is still NEW."""
    with temporary_engine() as engine:
        task = SuccessfulApp()
        engine.add(task)
        task.redo()
Example #10
0
def test_task_redo3():
    """Test that `.redo()` is a no-op if the Task is still NEW."""
    with temporary_core() as core:
        task = SuccessfulApp()
        task.attach(core)
        task.redo()
Example #11
0
def test_engine_redo_Task3():
    """Test that `Engine.redo()` is a no-op if the Task is still NEW."""
    with temporary_engine() as engine:
        task = SuccessfulApp()
        engine.add(task)
        task.redo()