areusch commented on a change in pull request #8708:
URL: https://github.com/apache/tvm/pull/8708#discussion_r689776861



##########
File path: 
apps/microtvm/arduino/template_project/tests/test_arduino_microtvm_api_server.py
##########
@@ -76,37 +78,31 @@ def test_find_modified_include_path(self, 
mock_pathlib_path):
         "utf-8",
     )
 
-    @mock.patch("subprocess.check_output")
-    def test_auto_detect_port(self, mock_subprocess_check_output):
+    @mock.patch("subprocess.run")
+    def test_auto_detect_port(self, mock_subprocess_run):
         process_mock = mock.Mock()
         handler = microtvm_api_server.Handler()
 
         # Test it returns the correct port when a board is connected
-        mock_subprocess_check_output.return_value = self.BOARD_CONNECTED_OUTPUT
+        mock_subprocess_run.return_value.stdout = self.BOARD_CONNECTED_OUTPUT
         detected_port = handler._auto_detect_port(self.DEFAULT_OPTIONS)
         assert detected_port == "/dev/ttyACM0"

Review comment:
       can you add a test-case for when "arduino_board": "nano33"?

##########
File path: 
apps/microtvm/arduino/template_project/tests/test_arduino_microtvm_api_server.py
##########
@@ -64,6 +65,7 @@ def test_find_modified_include_path(self, mock_pathlib_path):
 
     BOARD_CONNECTED_OUTPUT = bytes(
         "Port         Type              Board Name          FQBN               
         Core             \n"
+        "/dev/ttyACM1 Serial Port (USB) Wrong Arduino       
arduino:mbed_nano:nano33    arduino:mbed_nano\n"

Review comment:
       can you move this down one line, so that if the logic was naive and just 
looking for `"nano33" in FQBN`, it would find /dev/ttyACM0 first?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to