]> granicus.if.org Git - esp-idf/commitdiff
tiny-test-fw: handle case when ESPPORT is not set
authorIvan Grokhotkov <ivan@espressif.com>
Mon, 2 Jul 2018 13:45:27 +0000 (21:45 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Mon, 2 Jul 2018 13:45:27 +0000 (21:45 +0800)
Fix bug introduced in 8a88dd35, where .decode was called on result of
os.getenv, which was None if ESPPORT was not set.

tools/tiny-test-fw/IDF/IDFDUT.py

index d0baa7c1b40cdf67fa40f5e026cb44478645eecf..b5434d5fbab1de239ab1e056aa0241dd33f5c6f4 100644 (file)
@@ -131,7 +131,11 @@ class IDFDUT(DUT.SerialDUT):
     @classmethod
     def list_available_ports(cls):
         ports = [x.device for x in list_ports.comports()]
-        port_hint = os.getenv('ESPPORT').decode('utf8')
+        espport = os.getenv('ESPPORT')
+        if not espport:
+            return ports
+            
+        port_hint = espport.decode('utf8')
 
         # If $ESPPORT is a valid port, make it appear first in the list
         if port_hint in ports: