summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2021-10-15 18:41:20 +0100
committerAnuj Mittal <anuj.mittal@intel.com>2021-11-01 23:18:14 +0800
commit0392005d2ed9648ed6eedd3dd3541249bf4fc404 (patch)
tree4478b4a3c4ad0d9da3e16f5c0aacf36da2142898
parentb2c329641f91630ecbb225e8cd0cdcaf461d7ef6 (diff)
downloadopenembedded-core-contrib-0392005d2ed9648ed6eedd3dd3541249bf4fc404.tar.gz
testimage: fix unclosed testdata file
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>
-rw-r--r--meta/classes/testimage.bbclass7
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index e613759503..538ec4fc8a 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -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.