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
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
def test_OkCommunicationProcess_run__processes_get_device_id_debug_console_command( four_board_comm_process, ): ok_process = four_board_comm_process["ok_process"] board_queues = four_board_comm_process["board_queues"] input_queue = board_queues[0][0] response_queue = board_queues[0][1] simulator = FrontPanelSimulator({}) simulator.initialize_board() ok_process.set_board_connection(0, simulator) expected_id = "Mantarray XEM" simulator.set_device_id(expected_id) expected_returned_communication = { "communication_type": "debug_console", "command": "get_device_id", } put_object_into_queue_and_raise_error_if_eventually_still_empty( copy.deepcopy(expected_returned_communication), input_queue) invoke_process_run_and_check_errors(ok_process) expected_returned_communication["response"] = expected_id actual = response_queue.get(timeout=QUEUE_CHECK_TIMEOUT_SECONDS) assert actual == expected_returned_communication