]> 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)
committerAnuj Mittal <anuj.mittal@intel.com>
Tue, 26 Oct 2021 00:55:51 +0000 (08:55 +0800)
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: Anuj Mittal <anuj.mittal@intel.com>
meta/classes/testimage.bbclass

index a76e77385354e5aed3a2a46699e2b19f6addf700..4db05a4af4d1d635d49a96edbbb03b01db40d126 100644 (file)
@@ -235,9 +235,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.