瀏覽代碼

ci: Fix "local variable referenced before assignment" if connecting to DUT fails

Angus Gratton 6 年之前
父節點
當前提交
d3157910e0
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      tools/tiny-test-fw/IDF/IDFDUT.py

+ 2 - 1
tools/tiny-test-fw/IDF/IDFDUT.py

@@ -185,6 +185,7 @@ class IDFDUT(DUT.SerialDUT):
 
     @classmethod
     def confirm_dut(cls, port, app, **kwargs):
+        inst = None
         try:
             # TODO: check whether 8266 works with this logic
             # Otherwise overwrite it in ESP8266DUT
@@ -195,7 +196,7 @@ class IDFDUT(DUT.SerialDUT):
         except(esptool.FatalError, RuntimeError):
             return False
         finally:
-            if inst:
+            if inst is not None:
                 inst._port.close()
 
     @_uses_esptool