From 2de98cf4b997e27c6c48be9e3459b7db03b9e093 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 15 Oct 2021 18:41:20 +0100 Subject: testimage: fix unclosed testdata file (From OE-Core rev: a1e49456343a2be9adb6c0d1d970c2b0c070f53e) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit 0c192a97e3e1c015a48667d6903cc07a8b2620e4) Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- meta/classes/testimage.bbclass | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index db1d54e5cb..b1aef626f7 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass @@ -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. -- cgit v1.2.3-54-g00ecf