]> code.ossystems Code Review - openembedded-core.git/commitdiff
testimage: fix unclosed testdata file
authorRoss Burton <ross@burtonini.com>
Fri, 15 Oct 2021 17:41:20 +0000 (18:41 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 Nov 2021 11:17:55 +0000 (11:17 +0000)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0c192a97e3e1c015a48667d6903cc07a8b2620e4)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/classes/testimage.bbclass

index db1d54e5cb057710e6367810d84e2b9e38509992..b1aef626f79756ae016cc18d710030231a69f485 100644 (file)
@@ -229,9 +229,10 @@ def testimage_main(d):
 
     tdname = "%s.testdata.json" % image_name
     try:
-        td = json.load(open(tdname, "r"))
-    except (FileNotFoundError) as err:
-         bb.fatal('File %s Not Found. Have you built the image with INHERIT+="testimage" in the conf/local.conf?' % tdname)
+        with open(tdname, "r") as f:
+            td = json.load(f)
+    except FileNotFoundError as err:
+        bb.fatal('File %s not found (%s).\nHave you built the image with INHERIT += "testimage" in the conf/local.conf?' % (tdname, err))
 
     # Some variables need to be updates (mostly paths) with the
     # ones of the current environment because some tests require them.