From 6cfa08f301f813a688fc8c09d09dcec4cd66eb3b Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Tue, 16 Sep 2025 23:19:31 +0200 Subject: [PATCH] bitbake: tests/parse: Remove unnecessary calls to file.flush() There is no reason to call file.flush() as the last call within a file context manager since ending the context will close the file and thus flush it. (Bitbake rev: 90d5ce926d434d60d6df28b7d77b3cbc9b62ce14) Signed-off-by: Peter Kjellerstedt Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/parse.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index b272739f56..431b0c7d3e 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py @@ -349,14 +349,11 @@ EXPORT_FUNCTIONS do_compile do_compilepython os.makedirs(tempdir + "/classes") with open(tempdir + "/classes/someclass.bbclass", "w") as f: f.write(self.export_function_class) - f.flush() with open(tempdir + "/classes/secondclass.bbclass", "w") as f: f.write(self.export_function_class2) - f.flush() with open(recipename, "w") as f: f.write(self.export_function_recipe) - f.flush() os.chdir(tempdir) d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] self.assertIn("someclass_do_compile", d.getVar("do_compile")) @@ -366,7 +363,6 @@ EXPORT_FUNCTIONS do_compile do_compilepython recipename2 = tempdir + "/recipe2.bb" with open(recipename2, "w") as f: f.write(self.export_function_recipe2) - f.flush() d = bb.parse.handle(recipename2, bb.data.createCopy(self.d))[''] self.assertNotIn("someclass_do_compile", d.getVar("do_compile")) @@ -377,10 +373,8 @@ EXPORT_FUNCTIONS do_compile do_compilepython with open(recipename, "a+") as f: f.write("\ninherit secondclass\n") - f.flush() with open(recipename2, "a+") as f: f.write("\ninherit secondclass\n") - f.flush() d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] self.assertIn("secondclass_do_compile", d.getVar("do_compile")) @@ -418,7 +412,6 @@ include \\ recipename = tempdir + "/recipe_unclosed.bb" with open(recipename, "w") as f: f.write(content) - f.flush() os.chdir(tempdir) with self.assertRaises(bb.parse.ParseError) as error: bb.parse.handle(recipename, bb.data.createCopy(self.d)) @@ -434,7 +427,6 @@ include \\ lines = self.export_function_unclosed_tab.split("\n") lines[3] = "}" in_file.write("\n".join(lines)) - in_file.flush() bb.parse.handle(recipename_closed, bb.data.createCopy(self.d)) special_character_assignment = """