From: Simon Glass <simon.glass@canonical.com>
Fix several pylint warnings:
- C0123 (unidiomatic-typecheck): Use isinstance() rather than type()
- W1404 (implicit-str-concat): Add missing comma between arguments
- W1514/R1732: Use tools.read_file() instead of open() without encoding
The W1404 fix corrects a bug where '-x' and 'board4' are concatenated
into '-xboard4' instead of being separate arguments.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
tools/buildman/func_test.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
@@ -545,7 +545,7 @@ Idx Name Size VMA LMA File off Algn
else:
stderr = ("binman: Filename 'fsp.bin' not found in "
'input path')
- elif type(commit) is not str:
+ elif not isinstance(commit, str):
stderr = self._error.get((brd.target, commit.sequence))
else:
# For current source builds, commit is 'current'
@@ -610,12 +610,11 @@ Idx Name Size VMA LMA File off Algn
for brd in self._boards.get_list():
if brd.arch != 'sandbox':
errfile = self._builder.get_err_file(commit, brd.target)
- fd = open(errfile)
+ data = tools.read_file(errfile, binary=False)
self.assertEqual(
- fd.readlines(),
+ data.splitlines(),
[f'Tool chain error for {brd.arch}: '
f"No tool chain found for arch '{brd.arch}'"])
- fd.close()
def test_toolchain_errors(self):
"""Test that toolchain errors are reported in the summary
@@ -1362,7 +1361,8 @@ endif
def test_exclude_list(self):
"""Test excluding a list of things"""
- self._run_control('-x', 'board2', '-x' 'board4', '-o', self._output_dir)
+ self._run_control('-x', 'board2', '-x', 'board4', '-o',
+ self._output_dir)
self.assertEqual(['board0', 'board1'],
[b.target for b in self._boards.get_selected()])