[Concept,12/14] buildman: Fix misc pylint warnings in func_test

Message ID 20260110235633.1064859-13-sjg@u-boot.org
State New
Headers
Series buildman: Clean up pylint warnings in func_test |

Commit Message

Simon Glass Jan. 10, 2026, 11:56 p.m. UTC
  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(-)
  

Patch

diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 4112cde9a7b..44ca2499b85 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -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()])