]> 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>
Mon, 1 Nov 2021 15:18:14 +0000 (23:18 +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 e613759503119c7194bd395936e0154895a05242..538ec4fc8a71e9d3f209ab803d492cd2e58019c9 100644 (file)
@@ -230,9 +230,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.