]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/devtool: Avoid unbound variable errors
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 18 Nov 2019 15:20:13 +0000 (15:20 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 Nov 2019 21:17:40 +0000 (21:17 +0000)
inherits can be unset resulting in:

UnboundLocalError: local variable 'inherits' referenced before assignment

which can mask real errors. Avoid this.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/devtool.py

index 3a25da2033bae3cebb7e99c440a6b20c8d0e1e51..f4b303bd1c7694c371adbe53be7aa9af76546917 100644 (file)
@@ -137,6 +137,7 @@ class DevtoolBase(OESelftestTestCase):
         with open(recipefile, 'r') as f:
             invar = None
             invalue = None
+            inherits = set()
             for line in f:
                 var = None
                 if invar:
@@ -158,7 +159,7 @@ class DevtoolBase(OESelftestTestCase):
                         invar = var
                         continue
                 elif line.startswith('inherit '):
-                    inherits = line.split()[1:]
+                    inherits.update(line.split()[1:])
 
                 if var and var in checkvars:
                     needvalue = checkvars.pop(var)