diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2025-09-16 23:19:31 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-24 00:01:44 +0100 |
commit | 6cfa08f301f813a688fc8c09d09dcec4cd66eb3b (patch) | |
tree | c8f63534ad7f1aa21b803db9dbc62711a702ea21 /bitbake | |
parent | c948feaae41356f4c7c1611b6a9ab3a9569c6884 (diff) | |
download | poky-6cfa08f301f813a688fc8c09d09dcec4cd66eb3b.tar.gz |
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 <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 8 |
1 files changed, 0 insertions, 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 | |||
349 | os.makedirs(tempdir + "/classes") | 349 | os.makedirs(tempdir + "/classes") |
350 | with open(tempdir + "/classes/someclass.bbclass", "w") as f: | 350 | with open(tempdir + "/classes/someclass.bbclass", "w") as f: |
351 | f.write(self.export_function_class) | 351 | f.write(self.export_function_class) |
352 | f.flush() | ||
353 | with open(tempdir + "/classes/secondclass.bbclass", "w") as f: | 352 | with open(tempdir + "/classes/secondclass.bbclass", "w") as f: |
354 | f.write(self.export_function_class2) | 353 | f.write(self.export_function_class2) |
355 | f.flush() | ||
356 | 354 | ||
357 | with open(recipename, "w") as f: | 355 | with open(recipename, "w") as f: |
358 | f.write(self.export_function_recipe) | 356 | f.write(self.export_function_recipe) |
359 | f.flush() | ||
360 | os.chdir(tempdir) | 357 | os.chdir(tempdir) |
361 | d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] | 358 | d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] |
362 | self.assertIn("someclass_do_compile", d.getVar("do_compile")) | 359 | self.assertIn("someclass_do_compile", d.getVar("do_compile")) |
@@ -366,7 +363,6 @@ EXPORT_FUNCTIONS do_compile do_compilepython | |||
366 | recipename2 = tempdir + "/recipe2.bb" | 363 | recipename2 = tempdir + "/recipe2.bb" |
367 | with open(recipename2, "w") as f: | 364 | with open(recipename2, "w") as f: |
368 | f.write(self.export_function_recipe2) | 365 | f.write(self.export_function_recipe2) |
369 | f.flush() | ||
370 | 366 | ||
371 | d = bb.parse.handle(recipename2, bb.data.createCopy(self.d))[''] | 367 | d = bb.parse.handle(recipename2, bb.data.createCopy(self.d))[''] |
372 | self.assertNotIn("someclass_do_compile", d.getVar("do_compile")) | 368 | self.assertNotIn("someclass_do_compile", d.getVar("do_compile")) |
@@ -377,10 +373,8 @@ EXPORT_FUNCTIONS do_compile do_compilepython | |||
377 | 373 | ||
378 | with open(recipename, "a+") as f: | 374 | with open(recipename, "a+") as f: |
379 | f.write("\ninherit secondclass\n") | 375 | f.write("\ninherit secondclass\n") |
380 | f.flush() | ||
381 | with open(recipename2, "a+") as f: | 376 | with open(recipename2, "a+") as f: |
382 | f.write("\ninherit secondclass\n") | 377 | f.write("\ninherit secondclass\n") |
383 | f.flush() | ||
384 | 378 | ||
385 | d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] | 379 | d = bb.parse.handle(recipename, bb.data.createCopy(self.d))[''] |
386 | self.assertIn("secondclass_do_compile", d.getVar("do_compile")) | 380 | self.assertIn("secondclass_do_compile", d.getVar("do_compile")) |
@@ -418,7 +412,6 @@ include \\ | |||
418 | recipename = tempdir + "/recipe_unclosed.bb" | 412 | recipename = tempdir + "/recipe_unclosed.bb" |
419 | with open(recipename, "w") as f: | 413 | with open(recipename, "w") as f: |
420 | f.write(content) | 414 | f.write(content) |
421 | f.flush() | ||
422 | os.chdir(tempdir) | 415 | os.chdir(tempdir) |
423 | with self.assertRaises(bb.parse.ParseError) as error: | 416 | with self.assertRaises(bb.parse.ParseError) as error: |
424 | bb.parse.handle(recipename, bb.data.createCopy(self.d)) | 417 | bb.parse.handle(recipename, bb.data.createCopy(self.d)) |
@@ -434,7 +427,6 @@ include \\ | |||
434 | lines = self.export_function_unclosed_tab.split("\n") | 427 | lines = self.export_function_unclosed_tab.split("\n") |
435 | lines[3] = "}" | 428 | lines[3] = "}" |
436 | in_file.write("\n".join(lines)) | 429 | in_file.write("\n".join(lines)) |
437 | in_file.flush() | ||
438 | bb.parse.handle(recipename_closed, bb.data.createCopy(self.d)) | 430 | bb.parse.handle(recipename_closed, bb.data.createCopy(self.d)) |
439 | 431 | ||
440 | special_character_assignment = """ | 432 | special_character_assignment = """ |