def test_copy_delete_bug(caplog):
    from os.path import join

    libraries = {
        "ros":
        join(testing_utils.EXAMPLES_PATH, "libraries", "ros_libraries"),
        "turtle_libraries":
        join(testing_utils.EXAMPLES_PATH, "libraries", "turtle_libraries"),
        "generic":
        join(testing_utils.LIBRARY_SM_PATH, "generic")
    }
    change_in_gui_config = {
        'AUTO_BACKUP_ENABLED': False,
        'HISTORY_ENABLED': False
    }
    testing_utils.run_gui(
        gui_config=change_in_gui_config,
        libraries=libraries,
    )

    try:
        trigger_copy_delete_bug_signals()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#2
0
def test_pane_positions(caplog):
    testing_utils.run_gui(core_config=None,
                          gui_config={'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False},
                          runtime_config={
                              'MAIN_WINDOW_MAXIMIZED': False,
                              'MAIN_WINDOW_SIZE': (1500, 800),
                              'MAIN_WINDOW_POS': (0, 0),
                              'LEFT_BAR_DOCKED_POS': 400,
                              'RIGHT_BAR_DOCKED_POS': 800,
                              'CONSOLE_DOCKED_POS': 600,
                              'LEFT_BAR_WINDOW_UNDOCKED': False,
                              'RIGHT_BAR_WINDOW_UNDOCKED': False,
                              'CONSOLE_WINDOW_UNDOCKED': False,
                              'LEFT_BAR_HIDDEN': False,
                              'RIGHT_BAR_HIDDEN': False,
                              'CONSOLE_HIDDEN': False,
                          })
    from rafcon.gui.runtime_config import global_runtime_config
    original_runtime_config = global_runtime_config.as_dict()

    try:
        check_pane_positions()
    finally:
        for key, value in original_runtime_config.items():
            call_gui_callback(global_runtime_config.set_config_value, key, value)

        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#3
0
def test_on_clean_storing_with_name_in_path(caplog):
    print("test_on_clean_storing_with_name_in_path")

    testing_utils.dummy_gui(None)

    testing_utils.initialize_environment(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    },
                                         gui_already_started=False)

    path_old_format = testing_utils.get_test_sm_path(
        os.path.join("unit_test_state_machines",
                     "id_to_name_plus_id_storage_format_test_do_not_update"))
    path_new_format = os.path.join(
        testing_utils.get_unique_temp_path(),
        "id_to_name_plus_id_storage_format_test_do_not_update")

    # gui imports better after initialization
    from rafcon.gui.models.state_machine import StateMachineModel

    shutil.copytree(path_old_format, path_new_format)
    from rafcon.core.storage import storage
    sm = storage.load_state_machine_from_path(path_new_format)
    check_state_recursively_if_state_scripts_are_valid(sm.root_state)
    sm.base_path = path_new_format
    sm_m = StateMachineModel(sm)
    try:
        on_save_activate(sm_m, logger)
        check_that_all_files_are_there(sm, with_print=False)
        check_id_and_name_plus_id_format(path_old_format, path_new_format,
                                         sm_m)
    finally:
        testing_utils.shutdown_environment(caplog=caplog,
                                           unpatch_threading=False)
def test_backward_compatibility_storage(caplog):
    """This test ensures that old state machines storage formats can still be opened with the current RAFCON version"""
    path = testing_utils.get_test_sm_path(
        os.path.join("unit_test_state_machines", "backward_compatibility"))

    run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    },
            libraries={
                'unit_test_state_machines':
                testing_utils.get_test_sm_path("unit_test_state_machines")
            })

    try:
        run_backward_compatibility_state_machines(path)
    except Exception:
        raise
    finally:
        # two warning per minor version lower than the current RAFCON version
        state_machines = len([
            filename for filename in os.listdir(path)
            if os.path.isdir(os.path.join(path, filename))
        ])
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog, expected_warnings=0)
示例#5
0
def test_pane_positions(caplog):
    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    },
                          runtime_config={
                              'LEFT_BAR_DOCKED_POS': 500,
                              'RIGHT_BAR_DOCKED_POS': 950,
                              'CONSOLE_DOCKED_POS': 700,
                              'LEFT_BAR_WINDOW_UNDOCKED': False,
                              'RIGHT_BAR_WINDOW_UNDOCKED': False,
                              'CONSOLE_WINDOW_UNDOCKED': False
                          })
    from rafcon.gui.runtime_config import global_runtime_config
    original_runtime_config = global_runtime_config.as_dict()

    try:
        check_pane_positions()
    finally:
        for key, value in original_runtime_config.iteritems():
            call_gui_callback(global_runtime_config.set_config_value, key,
                              value)

        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#6
0
def test_gui(caplog):
    testing_utils.run_gui(
        gui_config={
            'AUTO_BACKUP_ENABLED': False,
            'CHECK_PYTHON_FILES_WITH_PYLINT': False,
            'PREFER_EXTERNAL_EDITOR': False
        })

    # queue = Queue.Queue() # TODO think about to use this to get call_back methods return value by a generic scheme
    # thread = threading.Thread(target=lambda q, arg1: q.put(trigger_source_editor_signals(arg1)), args=(queue, main_window_controller))
    errors = 1
    try:
        result = trigger_source_editor_signals()

        if not result:
            logger.error(
                "!The editor required in this test was not found on this machine. Test was aborted!"
            )
            errors = 2
    except:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=errors)
示例#7
0
def test_window_positions(caplog):
    testing_utils.run_gui(core_config=None,
                          runtime_config={
                              'LEFT_BAR_WINDOW_SIZE': (800, 800),
                              'RIGHT_BAR_WINDOW_SIZE': (800, 800),
                              'CONSOLE_WINDOW_SIZE': (800, 800),
                              'LEFT_BAR_WINDOW_POS': (10, 10),
                              'RIGHT_BAR_WINDOW_POS': (10, 10),
                              'CONSOLE_WINDOW_POS': (10, 10),
                              'LEFT_BAR_WINDOW_UNDOCKED': False,
                              'RIGHT_BAR_WINDOW_UNDOCKED': False,
                              'CONSOLE_WINDOW_UNDOCKED': False
                          },
                          gui_config={
                              'HISTORY_ENABLED': False,
                              'AUTO_BACKUP_ENABLED': False
                          })
    from rafcon.gui.runtime_config import global_runtime_config
    original_runtime_config = global_runtime_config.as_dict()

    try:
        undock_sidebars()
    finally:
        for key, value in original_runtime_config.iteritems():
            call_gui_callback(global_runtime_config.set_config_value, key,
                              value)

        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#8
0
def test_gui(caplog):
    from os.path import join

    change_in_gui_config = {
        'AUTO_BACKUP_ENABLED': False,
        'HISTORY_ENABLED': False
    }

    libraries = {
        "ros":
        join(testing_utils.EXAMPLES_PATH, "libraries", "ros_libraries"),
        "turtle_libraries":
        join(testing_utils.EXAMPLES_PATH, "libraries", "turtle_libraries"),
        "generic":
        join(testing_utils.LIBRARY_SM_PATH, "generic")
    }
    testing_utils.run_gui(gui_config=change_in_gui_config, libraries=libraries)

    try:
        trigger_gui_signals()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=1)
示例#9
0
def test_semantic_data(caplog):
    testing_utils.run_gui(gui_config={'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False})
    try:
        change_semantic_data_values()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#10
0
def test_recent_opened_state_machine_list(caplog):
    change_in_gui_config = {
        'AUTO_BACKUP_ENABLED': True,
        'HISTORY_ENABLED': False
    }

    libraries = {
        "ros":
        join(testing_utils.EXAMPLES_PATH, "libraries", "ros_libraries"),
        "turtle_libraries":
        join(testing_utils.EXAMPLES_PATH, "libraries", "turtle_libraries"),
        "generic":
        join(testing_utils.LIBRARY_SM_PATH, "generic")
    }
    testing_utils.run_gui(gui_config=change_in_gui_config,
                          libraries=libraries)  # , patch_threading=False)
    call_gui_callback(patch_backup_threading)
    try:
        trigger_gui_signals()
    except:
        raise
    finally:
        call_gui_callback(unpatch_backup_threading)
        testing_utils.close_gui()
        testing_utils.shutdown_environment(
            caplog=caplog, expected_warnings=0,
            expected_errors=1)  # , unpatch_threading=False)
示例#11
0
def test_storage_with_gui(with_gui, caplog):
    print("test storage with gui", with_gui)

    testing_utils.dummy_gui(None)

    if with_gui:
        testing_utils.run_gui(gui_config={
            'HISTORY_ENABLED': False,
            'AUTO_BACKUP_ENABLED': False
        })
    else:
        testing_utils.initialize_environment(gui_config={
            'HISTORY_ENABLED': False,
            'AUTO_BACKUP_ENABLED': False
        },
                                             gui_already_started=False)

    e = None
    try:
        save_state_machine(with_gui)
    except Exception as e:
        pass
    finally:
        if with_gui:
            testing_utils.close_gui()
            testing_utils.shutdown_environment(caplog=caplog)
        else:
            testing_utils.shutdown_environment(caplog=caplog,
                                               unpatch_threading=False)

    if e:
        raise e
    print("test storage with gui {0} finished".format(with_gui))
示例#12
0
def test_simple(caplog):
    """Do all copy strategies possible in RAFCON and check if all Objects have different memory location to secure
    reference free assignments from origin to new state.
    :param caplog:
    :return:
    """
    testing_utils.dummy_gui(None)
    print("start test simple")
    # create testbed
    testing_utils.initialize_environment(
        gui_already_started=False,
        gui_config={
            'HISTORY_ENABLED': False,
            'AUTO_BACKUP_ENABLED': False
        },
    )

    [state, sm_model, state_dict] = create_models()
    run_copy_test(sm_model)
    run_copy_performance_test_and_check_storage_copy(sm_model)
    # currently destroy doesn't do anything if auto_backup is disabled
    sm_model.destroy()
    import rafcon
    rafcon.core.singleton.state_machine_manager.delete_all_state_machines()

    [state, sm_model, state_dict] = create_models_concurrency()
    run_copy_test(sm_model)
    run_copy_performance_test_and_check_storage_copy(sm_model)
    # currently destroy doesn't do anything if auto_backup is disabled
    sm_model.destroy()
    rafcon.core.singleton.state_machine_manager.delete_all_state_machines()
    # wait until state machine model is destroyed
    testing_utils.wait_for_gui()
    testing_utils.shutdown_environment(caplog=caplog, unpatch_threading=False)
    print("test simple finished")
示例#13
0
def test_api_example(caplog):

    path_of_api_examples = os.path.join(testing_utils.EXAMPLES_PATH, 'api',
                                        'generate_state_machine')
    sys.path.insert(0, path_of_api_examples)

    testing_utils.test_multithreading_lock.acquire()
    try:
        import basic_turtle_state_machine
        # TODO maybe extend example to run ros processes to check functionality of state machine too
        duration_wait_for_gui = 0.1
        timed_thread = threading.Timer(5 * duration_wait_for_gui,
                                       shutdown_gui,
                                       args=[
                                           duration_wait_for_gui,
                                       ])
        timed_thread.daemon = True
        timed_thread.start()

        basic_turtle_state_machine.run_turtle_demo()
        logger.debug("after gtk main")
        timed_thread.join()
    finally:
        sys.path.remove(path_of_api_examples)
        testing_utils.shutdown_environment(caplog=caplog,
                                           unpatch_threading=False)
示例#14
0
def test_drag_and_drop_test(caplog):
    testing_utils.run_gui(
        gui_config={
            'AUTO_BACKUP_ENABLED': False,
            'HISTORY_ENABLED': False
        },
        runtime_config={
            'MAIN_WINDOW_MAXIMIZED': False,
            'MAIN_WINDOW_SIZE': (1500, 800),
            'MAIN_WINDOW_POS': (0, 0),
            'LEFT_BAR_WINDOW_UNDOCKED': False,
            'RIGHT_BAR_WINDOW_UNDOCKED': False,
            'CONSOLE_WINDOW_UNDOCKED': False,
            'LEFT_BAR_HIDDEN': True,
            'RIGHT_BAR_HIDDEN': True,
            'CONSOLE_HIDDEN': True,
        },
        libraries={
            "unit_test_state_machines":
            testing_utils.get_test_sm_path("unit_test_state_machines")
        })
    import rafcon.core.singleton
    call_gui_callback(create_models)

    try:
        trigger_drag_and_drop_tests(
            rafcon.gui.singleton.state_machine_manager_model,
            rafcon.gui.singleton.main_window_controller)
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=1,
                                           expected_errors=0)
示例#15
0
def test_backward_stepping_preemptive_state(caplog):
    testing_utils.run_gui(gui_config={'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False})
    call_gui_callback(initialize_global_variables)
    try:
        execute_preemptive_state_forwards_backwards()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#16
0
def test_simple_state_size_resize(state_path, recursive, rel_size, caplog,
                                  monkeypatch):
    testing_utils.run_gui(gui_config={'HISTORY_ENABLED': True})

    try:
        from rafcon.gui.helpers.meta_data import check_gaphas_state_meta_data_consistency
        sm_m, canvas, view = open_test_state_machine()

        state_m = sm_m.get_state_model_by_path(state_path)
        state_v = canvas.get_view_for_model(state_m)

        orig_state_size = state_m.get_meta_data_editor()["size"]
        check_gaphas_state_meta_data_consistency(state_m,
                                                 canvas,
                                                 recursive=True)
        print "\ninitial:"
        print_state_sizes(state_m, canvas, ["C"])

        view_rel_size = transform_size_v2i(view, state_v, rel_size)
        resize_state(view, state_v, rel_size, 3, recursive, monkeypatch)
        new_state_size = add_vectors(orig_state_size, view_rel_size)
        print "\nfirst resize:"
        print_state_sizes(state_m, canvas, ["C"])
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    new_state_size, canvas)

        rel_size = (-rel_size[0], -rel_size[1])
        view_rel_size = transform_size_v2i(view, state_v, rel_size)
        resize_state(view, state_v, rel_size, 3, recursive, monkeypatch)
        print "\nsecond resize:"
        print_state_sizes(state_m, canvas, ["C"])
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    orig_state_size, canvas)

        call_gui_callback(sm_m.history.undo)
        print "\nfirst undo:"
        print_state_sizes(state_m, canvas, ["C"])
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    new_state_size, canvas)

        call_gui_callback(sm_m.history.undo)
        print "\nsecond undo:"
        print_state_sizes(state_m, canvas, ["C"])
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    orig_state_size, canvas)

        call_gui_callback(sm_m.history.redo)
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    new_state_size, canvas)

        call_gui_callback(sm_m.history.redo)
        assert_state_size_and_meta_data_consistency(state_m, state_v,
                                                    orig_state_size, canvas)

    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#17
0
def test_plugins_example(caplog):

    os.environ['RAFCON_PLUGIN_PATH'] = os.path.join(
        testing_utils.EXAMPLES_PATH, 'plugins', 'templates')
    print os.environ.get('RAFCON_PLUGIN_PATH')
    path_of_sm_to_run = testing_utils.get_test_sm_path(
        join("unit_test_state_machines", "99_bottles_of_beer_monitoring"))
    # testing_utils.initialize_environment()
    testing_utils.test_multithreading_lock.acquire()
    try:
        cmd = join(testing_utils.RAFCON_PATH, 'gui',
                   'start.py') + ' -o ' + path_of_sm_to_run + " -ss"
        start_time = time.time()
        rafcon_gui_process = subprocess.Popen(cmd,
                                              shell=True,
                                              stdout=subprocess.PIPE,
                                              stderr=subprocess.PIPE)
        # See https://stackoverflow.com/a/36477512 for details
        # Note: This (select and poll) only works on POSIX systems, not on Windows!
        poller = select.poll()
        poller.register(rafcon_gui_process.stdout, select.POLLIN)

        plugin_loaded = False
        while True:
            if poller.poll(0.1):
                line = rafcon_gui_process.stdout.readline().rstrip()
                print "process:", line
                if "Successfully loaded plugin 'templates'" in line:
                    print "=> plugin loaded"
                    plugin_loaded = True
                if "rafcon.gui.controllers.main_window" in line and "Ready" in line:
                    print "=> ready"
                    assert plugin_loaded
                    time.sleep(0.5)  # safety margin...
                    print "=> RAFCON is now terminated"
                    rafcon_gui_process.terminate()
                    stdout, _ = rafcon_gui_process.communicate()
                    exception_count = 0
                    for line in stdout.rstrip().split("\n"):
                        print "process:", line
                        if "Exception" in line:
                            exception_count += 1
                    assert exception_count == 0
                    assert rafcon_gui_process.returncode == 0
                    break
            else:
                # kill process after 10 seconds and return with a failure
                if time.time() - start_time > 10:
                    rafcon_gui_process.kill()
                    rafcon_gui_process.communicate()
                    assert False, "RAFCON did not start in time"
    finally:
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=0,
                                           unpatch_threading=False)
def test_state_type_change_test(caplog):
    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    })
    try:
        trigger_state_type_change_tests(with_gui=True)
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#19
0
def test_dialog_test(caplog):
    testing_utils.dummy_gui(None)

    testing_utils.initialize_environment(gui_already_started=False)

    logger.debug("Dialog test started.")

    thread = threading.Thread(target=trigger_dialog_tests)
    thread.start()
    testing_utils.shutdown_environment(caplog=caplog, expected_warnings=0, expected_errors=0, unpatch_threading=False)
def test_unchanged_storage_format(caplog):
    """This test ensures that the state machine storage format does not change in patch releases"""

    from rafcon.core.storage import storage
    from rafcon.gui.models.state_machine import StateMachineModel
    import rafcon

    path = get_backward_compatibility_state_machines_path()
    if not os.path.exists(path):
        logger.info(
            "test_unchanged_storage_format: the current python interpreter version is not supported"
        )
        return

    testing_utils.initialize_environment(
        gui_config={
            'HISTORY_ENABLED': False,
            'AUTO_BACKUP_ENABLED': False
        },
        libraries={
            'unit_test_state_machines':
            testing_utils.get_test_sm_path("unit_test_state_machines")
        },
        gui_already_started=False)
    try:
        current_rafcon_version = StrictVersion(rafcon.__version__).version
        current_minor = "{}.{}".format(current_rafcon_version[0],
                                       current_rafcon_version[1])
        for filename in os.listdir(path):
            if filename.startswith(current_minor):
                old_state_machine_path = os.path.join(path, filename)
                break
        else:
            assert False, "There is no state machine for the current RAFCON minor version {}".format(
                current_minor)

        state_machine = storage.load_state_machine_from_path(
            old_state_machine_path)
        state_machine_m = StateMachineModel(state_machine)
        new_state_machine_path = testing_utils.get_unique_temp_path()
        storage.save_state_machine_to_path(state_machine,
                                           new_state_machine_path, True, True)
        state_machine_m.store_meta_data(copy_path=new_state_machine_path)

        old_state_machine_hash = calculate_state_machine_hash(
            old_state_machine_path)
        new_state_machine_hash = calculate_state_machine_hash(
            new_state_machine_path)
        assert old_state_machine_hash.digest(
        ) == new_state_machine_hash.digest()
    except Exception:
        raise
    finally:
        testing_utils.shutdown_environment(caplog=caplog,
                                           unpatch_threading=False)
示例#21
0
def test_state_machine_baking(caplog):
    testing_utils.dummy_gui(caplog)

    testing_utils.run_gui(
        gui_config={'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False},
        libraries={'unit_test_state_machines': testing_utils.get_test_sm_path("unit_test_state_machines")}
    )
    try:
        trigger_baking_commands()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#22
0
def test_bug_issue_586(caplog):
    testing_utils.run_gui(gui_config={
        'AUTO_BACKUP_ENABLED': False,
        'HISTORY_ENABLED': True
    },
                          libraries={})

    try:
        trigger_issue_586_reproduction_sequence()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#23
0
def test_repetitive_ungroup_state_and_group_states(caplog):
    """Check if repetitive group and ungroup works"""
    libraries = {"unit_test_state_machines": testing_utils.get_test_sm_path("unit_test_state_machines")}
    testing_utils.run_gui(gui_config={'HISTORY_ENABLED': True}, libraries=libraries)
    try:
        trigger_repetitive_group_ungroup()
    except Exception:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog, expected_warnings=0, expected_errors=1)
    pass
示例#24
0
def test_notification_debugging_example(caplog):
    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    })
    try:
        patch_notifications()
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=0)
示例#25
0
def test_dynamic_state_insertion(caplog):
    testing_utils.run_gui(
        gui_config={'HISTORY_ENABLED': False, 'AUTO_BACKUP_ENABLED': False},
        libraries={'unit_test_state_machines': testing_utils.get_test_sm_path("unit_test_state_machines")}
    )
    try:
        execute_dynamic_state_insertion()
    except Exception:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#26
0
def test_thread_observer_creation_list(caplog):
    # TODO use the patch/unpatch support of py.test
    testing_utils.run_gui()

    try:
        run_create()
    except:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=0)
示例#27
0
def test_gui_tests(monkeypatch, caplog):
    # let the gui thread create the gui singletons by opening and closing an empty gui
    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    })

    try:
        pass
    except:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog)
示例#28
0
def test_resave(caplog):
    testing_utils.initialize_environment(gui_already_started=False)
    folder_to_convert = testing_utils.TUTORIAL_PATH
    target_folder = os.path.join(testing_utils.RAFCON_TEMP_PATH_TEST_BASE,
                                 "resave_test")
    config_path = os.path.join(testing_utils.TESTS_PATH, "assets", "configs",
                               "valid_config")
    print "folder to convert: " + folder_to_convert
    print "config path: " + config_path
    import rafcon.gui.resave_state_machines as resave
    resave.convert_libraries_in_path(config_path, folder_to_convert,
                                     target_folder)

    testing_utils.shutdown_environment(caplog=caplog, unpatch_threading=False)
示例#29
0
def test_dialog_test(caplog):
    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    })
    logger.debug("Dialog test started.")
    try:
        trigger_dialog_tests()
    except Exception:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=0)
示例#30
0
def test_gui(caplog):

    testing_utils.run_gui(gui_config={
        'HISTORY_ENABLED': False,
        'AUTO_BACKUP_ENABLED': False
    })
    try:
        trigger_gvm_signals()
    except:
        raise
    finally:
        testing_utils.close_gui()
        testing_utils.shutdown_environment(caplog=caplog,
                                           expected_warnings=0,
                                           expected_errors=1)