コード例 #1
0
def test_lock_state_machine(caplog):

    state_machine = StateMachine()

    @lock_state_machine
    def custom_function(object, number):
        raise AttributeError("Test error")

    State.custom_method = custom_function

    state1 = ExecutionState("s1")
    state_machine.root_state = state1

    try:
        state1.custom_method(5)
    except Exception as e:
        import traceback
        print("Could not stop state machine: {0} {1}".format(
            e, traceback.format_exc()))

    assert global_lock_counter == 0

    state1.add_outcome("outcome1", 3)
    assert len(state1.outcomes) == 4

    assert_logger_warnings_and_errors(caplog)
コード例 #2
0
ファイル: test_state_machine.py プロジェクト: uservinu/RAFCON
def test_lock_state_machine(caplog):

    state_machine = StateMachine()

    @lock_state_machine
    def custom_function(object, number):
        raise AttributeError("Test error")

    State.custom_method = custom_function

    state1 = ExecutionState("s1")
    state_machine.root_state = state1

    try:
        state1.custom_method(5)
    except Exception, e:
        import traceback
        print "Could not stop state machine: {0} {1}".format(
            e.message, traceback.format_exc())