From: Ola x Nilsson Date: Mon, 21 Oct 2019 10:30:26 +0000 (+0200) Subject: oeqa/selftest/recipetool: Use with to control file handle lifetime X-Git-Tag: uninative-2.8~1290 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=890fbd77315474fbd582f8bbeb26925c6a42d8d4;p=openembedded-core.git oeqa/selftest/recipetool: Use with to control file handle lifetime Signed-off-by: Ola x Nilsson Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 1c701a40bf..c1562c63b2 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -685,7 +685,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) bitbake('%s:do_unpack' % testrecipe) - self.assertEqual(open(self.testfile, 'r').read(), open(os.path.join(srcdir, filepath), 'r').read()) + with open(self.testfile, 'r') as testfile: + with open(os.path.join(srcdir, filepath), 'r') as makefilein: + self.assertEqual(testfile.read(), makefilein.read()) def test_recipetool_appendsrcfiles_basic(self, destdir=None): newfiles = [self.testfile]