From d3157910e05d30c081ed0c19c61784894ba44def Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 17 Oct 2019 14:38:49 +1100 Subject: [PATCH] ci: Fix "local variable referenced before assignment" if connecting to DUT fails --- tools/tiny-test-fw/IDF/IDFDUT.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tiny-test-fw/IDF/IDFDUT.py b/tools/tiny-test-fw/IDF/IDFDUT.py index 4a46b3cb6d..a360e45042 100644 --- a/tools/tiny-test-fw/IDF/IDFDUT.py +++ b/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