Пример #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()
Пример #2
0
def test_task_progress():
    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
Пример #3
0
def test_task_progress():
    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
Пример #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):
            task.redo()
            pytest.fail("`Task.redo()` succeeded on task not yet finished")
Пример #5
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()
Пример #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]
Пример #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]