From: Ross Burton Date: Fri, 15 Oct 2021 17:41:20 +0000 (+0100) Subject: testimage: fix unclosed testdata file X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~6447 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c192a97e3e1c015a48667d6903cc07a8b2620e4;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git testimage: fix unclosed testdata file Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index a76e7738535..4db05a4af4d 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass @@ -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.