def setup_function(_): # set the test_libraries path temporarily to the correct value global_config.set_config_value("LIBRARY_RECOVERY_MODE", True) testing_utils.rewind_and_set_libraries({ "unit_test_state_machines": join(testing_utils.TEST_ASSETS_PATH, "unit_test_state_machines") })
def setup_module(module=None): # set the test_libraries path temporarily to the correct value testing_utils.rewind_and_set_libraries( {"temporary_libraries": TEST_LIBRARY_PATH})
def test_step_through_library(caplog): testing_utils.initialize_environment_core() testing_utils.rewind_and_set_libraries({ "unit_test_state_machines": os.path.join(testing_utils.TEST_ASSETS_PATH, "unit_test_state_machines") }) state_machine = storage.load_state_machine_from_path( testing_utils.get_test_sm_path( os.path.join("unit_test_state_machines", "stepping_test_with_library"))) rafcon.core.singleton.state_machine_manager.add_state_machine( state_machine) with state_machine_execution_engine._status.execution_condition_variable: state_machine_execution_engine.synchronization_counter = 0 rafcon.core.singleton.state_machine_execution_engine.step_mode( state_machine.state_machine_id) wait_for_execution_engine_sync_counter(1, logger) # step till library rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) # step into library and step out rafcon.core.singleton.state_machine_execution_engine.step_into() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_out() wait_for_execution_engine_sync_counter(1, logger) # step till library rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) # step into library and step over library children rafcon.core.singleton.state_machine_execution_engine.step_into() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) # step over last library item rafcon.core.singleton.state_machine_execution_engine.step_over() wait_for_execution_engine_sync_counter(1, logger) rafcon.core.singleton.state_machine_execution_engine.stop() rafcon.core.singleton.state_machine_execution_engine.join() try: from rafcon.core.state_elements.scope import ScopedVariable for s in state_machine.root_state.scoped_data.values(): if s.name == 'bottles' and s.data_port_type == ScopedVariable: assert s.value == 4 finally: testing_utils.shutdown_environment_only_core(caplog=caplog)
def setup_module(module=None): # set the test_libraries path temporarily to the correct value testing_utils.test_multithreading_lock.acquire() testing_utils.rewind_and_set_libraries({"unit_test_state_machines": testing_utils.get_test_sm_path("unit_test_state_machines")}) logger.debug(rafcon.core.config.global_config.get_config_value("LIBRARY_PATHS")["unit_test_state_machines"])