Beispiel #1
0
def test_OkCommunicationProcess_run__correctly_sets_mantarray_serial_number(
    four_board_comm_process, ):
    ok_process = four_board_comm_process["ok_process"]
    board_queues = four_board_comm_process["board_queues"]
    expected_serial_number = RunningFIFOSimulator.default_mantarray_serial_number

    simulator = FrontPanelSimulator({})
    simulator.set_device_id("Existing Device ID")
    ok_process.set_board_connection(0, simulator)

    input_queue = board_queues[0][0]
    expected_returned_communication = {
        "communication_type": "mantarray_naming",
        "command": "set_mantarray_serial_number",
        "mantarray_serial_number": expected_serial_number,
    }
    input_queue.put_nowait(copy.deepcopy(expected_returned_communication))
    assert is_queue_eventually_not_empty(input_queue) is True

    invoke_process_run_and_check_errors(ok_process)
    actual = simulator.get_device_id()
    assert actual == expected_serial_number
Beispiel #2
0
def test_OkCommunicationProcess_run__correctly_sets_mantarray_nickname_without_serial_number_present(
        test_device_id, test_description, four_board_comm_process):
    ok_process = four_board_comm_process["ok_process"]
    board_queues = four_board_comm_process["board_queues"]
    expected_nickname = "New Nickname"

    simulator = FrontPanelSimulator({})
    simulator.set_device_id("Not a serial number")
    ok_process.set_board_connection(0, simulator)

    input_queue = board_queues[0][0]
    expected_returned_communication = {
        "communication_type": "mantarray_naming",
        "command": "set_mantarray_nickname",
        "mantarray_nickname": expected_nickname,
    }
    input_queue.put_nowait(copy.deepcopy(expected_returned_communication))
    assert is_queue_eventually_not_empty(input_queue) is True

    invoke_process_run_and_check_errors(ok_process)
    actual = simulator.get_device_id()
    assert actual == expected_nickname