def test_draw_process_life_cycle():
    try:
        from util.process_life_cycle import ProcessLifeCycle

        process_life_cycle = ProcessLifeCycle(None)
        process_life_cycle.get_fsm_builder().draw("launch_state_diagram.png")
        assert os.path.isfile("launch_state_diagram.png") is True
    finally:
        os.remove("launch_state_diagram.png")
def draw_state_diagram():
    process_life_cycle = ProcessLifeCycle(None)
    config_life_cycle = ConfigLifeCycle(None, None, None, None)

    process_life_cycle.get_fsm_builder().draw(
        "docs/fsm/graphviz/launch_state_diagram.png",
        title="Process Life Cycle")
    config_life_cycle.get_fsm_builder().draw(
        "docs/fsm/graphviz/config_cycle_state_diagram.png",
        title="Configuration Life Cycle",
    )
def test_draw_process_life_cycle():
    directory_path = os.path.dirname(os.path.abspath(__file__))
    file_name = "launch_state_diagram"
    file_extension = ".png"
    file_path_1 = os.path.join(directory_path, file_name + file_extension)
    file_path_2 = os.path.join(directory_path, file_name)
    try:
        from util.process_life_cycle import ProcessLifeCycle

        process_life_cycle = ProcessLifeCycle(None)
        process_life_cycle.get_fsm_builder().draw(file_path_1)
        assert os.path.isfile(file_path_1) is True
    finally:
        if os.path.isfile(file_path_1):
            os.remove(file_path_1)
        if os.path.isfile(file_path_2):
            os.remove(file_path_2)