]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.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>
Sat, 16 Oct 2021 16:43:53 +0000 (17:43 +0100)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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.