From patchwork Tue Jan 6 14:28:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1284 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709739; bh=UZK80MM+Chpq638sHMvQCup3iZ326c2rWmy+vw3eUAI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=b2nz6USJxS8mqL3+k4FcOb8vUDP/YXFL7GGa9YZBLkxiBm5eFHPTyr/aXaFa6Wtal 40+w4C3vVLt9JAMmfD56O/6l4ZTQ69VeOdZw+zo3DRfBmOJomMQMnpOpSwL6nK2g5x 6n2yI20b83Xjq3L2pXPFWDTYf4nswaFFc3DKejc6NA6FNpZO8d+cLuWogVl4rhYwA2 NGrPD60luueKrl1STDCv9t5E6uWhEsvDib1+YY6H3Xa0bLCr00yNOrVUD5jUc545pg ThBLAgzeQMZ45hcD16vDWvixlrBQzKZSB7VtbT7eo6/B5DTm0J1lKB9lpappP+nbUg KmaJvO6xGNP1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C58D269054 for ; Tue, 6 Jan 2026 07:28:59 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XZIPLq1TTVHu for ; Tue, 6 Jan 2026 07:28:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709739; bh=UZK80MM+Chpq638sHMvQCup3iZ326c2rWmy+vw3eUAI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=b2nz6USJxS8mqL3+k4FcOb8vUDP/YXFL7GGa9YZBLkxiBm5eFHPTyr/aXaFa6Wtal 40+w4C3vVLt9JAMmfD56O/6l4ZTQ69VeOdZw+zo3DRfBmOJomMQMnpOpSwL6nK2g5x 6n2yI20b83Xjq3L2pXPFWDTYf4nswaFFc3DKejc6NA6FNpZO8d+cLuWogVl4rhYwA2 NGrPD60luueKrl1STDCv9t5E6uWhEsvDib1+YY6H3Xa0bLCr00yNOrVUD5jUc545pg ThBLAgzeQMZ45hcD16vDWvixlrBQzKZSB7VtbT7eo6/B5DTm0J1lKB9lpappP+nbUg KmaJvO6xGNP1w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B4F4469118 for ; Tue, 6 Jan 2026 07:28:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709737; bh=Kwb5mi8ESDit1JImSwpeeV+Bo6ZehAwyf9UCm7K3Pjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOZn5T84io5Q+OlhdZc2w8QBimrdfcH32Fruq3JWVZ4uunpxWf1vL6WX1blBMC2Y1 OJRepytsljOafxv8uvSdvSU3Y6/lGvOZkkt+I1FhY8+8+GpFGDlbg/hv6Qw16hmSVh UBst1uo5+flY+eh3QUStXb7LmPLmx1oXXNl5j0MEF2AY15jNBu/ZJgAGQKjIXbaUmW RFRdKjzYBCuGIowfLF+SNl62F+h8iI3KLMkU9Rc9+QyLE0MIM5D0CQ9B6RVS6iff+b WUCGfWXDX+ChfkYz1vaPJGVQPWz8ds5j2sXmXWzIqJ7DALYtxGEtOlZQ/pAofmALY+ hQFmpM/9NFdTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6FC5E6912C; Tue, 6 Jan 2026 07:28:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id s4aMIcM29g_I; Tue, 6 Jan 2026 07:28:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709733; bh=3krWZ9ybEEr/gQuqXpgRYQPHXA+P7nOb/SNCXnLtAIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVwLfWbqxLMQxJ7FFMt4NHlYDwfV8vW1sbEBU6k+OXoO2FKWV0MN+t/YZZzdy4qO/ 17kcY7k5DPqQ6DEeMhF+U8e1i3MN7WTG1V7vpxBLTV7vBTKwymS0EjMwhBLyt1PZ91 3g6HDJ6MjrUuHX+Uy7IYNiSuDaOKdVcUUHz6NLvGd1RsFRU3Ao4uUtpwHjo1Fm66iv W8JJ0FvSnZ3hd+f5mrKTOo6UfSBYMVumR/2DPQUhwWTyOtud76/ibcF75KN3ciTdRI cqkYfbBgFzLb2bo/8MlI+VfGPVSsLw8qhg7WO6oppbjpqRXoIML/SjGucZaBw/CNbi HeP3oeYzfupzg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D98F469118; Tue, 6 Jan 2026 07:28:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 07:28:08 -0700 Message-ID: <20260106142834.2511220-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106142834.2511220-1-sjg@u-boot.org> References: <20260106142834.2511220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JQVN6UHYERKG5D6CQ5J7CYLTKVLNA4AB X-Message-ID-Hash: JQVN6UHYERKG5D6CQ5J7CYLTKVLNA4AB X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/22] buildman: Convert to f-strings in test.py List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Convert % string formatting to f-strings for better readability and to address pylint C0209 warnings. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/test.py | 45 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 735d93a0b7b..1e681b0595c 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -207,8 +207,8 @@ class TestBuild(unittest.TestCase): boardnum = int(brd.target[-1]) result.return_code = 0 result.stderr = '' - result.stdout = ('This is the test output for board %s, commit %s' % - (brd.target, commit.hash)) + result.stdout = (f'This is the test output for board {brd.target}, ' + f'commit {commit.hash}') if ((boardnum >= 1 and boardnum >= commit.sequence) or boardnum == 4 and commit.sequence == 6): result.return_code = commit.return_code @@ -224,12 +224,12 @@ class TestBuild(unittest.TestCase): col = self._col expected_colour = (col.GREEN if outcome == OUTCOME_OK else col.YELLOW if outcome == OUTCOME_WARN else col.RED) - expect = '%10s: ' % arch + expect = f'{arch:>10}: ' # TODO(sjg@chromium.org): If plus is '', we shouldn't need this expect += ' ' + col.build(expected_colour, plus) expect += ' ' for brd in brds: - expect += col.build(expected_colour, ' %s' % brd) + expect += col.build(expected_colour, f' {brd}') self.assertEqual(text, expect) def _SetupTest(self, echo_lines=False, threads=1, **kwdisplay_args): @@ -301,7 +301,7 @@ class TestBuild(unittest.TestCase): expect = self._col.build(colour, prefix + '(') expect += self._col.build(self._col.MAGENTA, brds, bright=False) - expect += self._col.build(colour, ') %s' % line) + expect += self._col.build(colour, f') {line}') else: expect = self._col.build(colour, prefix + line) new_lines.append(expect) @@ -316,7 +316,7 @@ class TestBuild(unittest.TestCase): boards4 = 'board4' if list_error_boards else '' # Upstream commit: migration warnings only - self.assertEqual(next(lines).text, '01: %s' % commits[0][1]) + self.assertEqual(next(lines).text, f'01: {commits[0][1]}') if not filter_migration_warnings: self.assertSummary(next(lines).text, 'arm', 'w+', @@ -330,7 +330,7 @@ class TestBuild(unittest.TestCase): add_line_prefix('+', boards01234, migration, col.RED)) # Second commit: all archs should fail with warnings - self.assertEqual(next(lines).text, '02: %s' % commits[1][1]) + self.assertEqual(next(lines).text, f'02: {commits[1][1]}') if filter_migration_warnings: self.assertSummary(next(lines).text, 'arm', 'w+', @@ -345,7 +345,7 @@ class TestBuild(unittest.TestCase): add_line_prefix('w+', boards1234, errors[0], col.YELLOW)) # Third commit: Still fails - self.assertEqual(next(lines).text, '03: %s' % commits[2][1]) + self.assertEqual(next(lines).text, f'03: {commits[2][1]}') if filter_migration_warnings: self.assertSummary(next(lines).text, 'arm', '', ['board1'], outcome=OUTCOME_OK) @@ -358,15 +358,15 @@ class TestBuild(unittest.TestCase): add_line_prefix('+', boards234, errors[1], col.RED)) # Fourth commit: Compile errors are fixed, just have warning for board3 - self.assertEqual(next(lines).text, '04: %s' % commits[3][1]) + self.assertEqual(next(lines).text, f'04: {commits[3][1]}') if filter_migration_warnings: - expect = '%10s: ' % 'powerpc' + expect = f"{'powerpc':>10}: " expect += ' ' + col.build(col.GREEN, '') expect += ' ' - expect += col.build(col.GREEN, ' %s' % 'board2') + expect += col.build(col.GREEN, ' board2') expect += ' ' + col.build(col.YELLOW, 'w+') expect += ' ' - expect += col.build(col.YELLOW, ' %s' % 'board3') + expect += col.build(col.YELLOW, ' board3') self.assertEqual(next(lines).text, expect) else: self.assertSummary(next(lines).text, 'powerpc', 'w+', @@ -384,7 +384,7 @@ class TestBuild(unittest.TestCase): add_line_prefix('w+', boards34, errors[2], col.YELLOW)) # Fifth commit - self.assertEqual(next(lines).text, '05: %s' % commits[4][1]) + self.assertEqual(next(lines).text, f'05: {commits[4][1]}') if filter_migration_warnings: self.assertSummary(next(lines).text, 'powerpc', '', ['board3'], outcome=OUTCOME_OK) @@ -403,7 +403,7 @@ class TestBuild(unittest.TestCase): add_line_prefix('w-', boards34, errors[2], col.CYAN)) # Sixth commit - self.assertEqual(next(lines).text, '06: %s' % commits[5][1]) + self.assertEqual(next(lines).text, f'06: {commits[5][1]}') if filter_migration_warnings: self.assertSummary(next(lines).text, 'sandbox', '', ['board4'], outcome=OUTCOME_OK) @@ -421,7 +421,7 @@ class TestBuild(unittest.TestCase): add_line_prefix('w-', boards4, errors[0], col.CYAN)) # Seventh commit - self.assertEqual(next(lines).text, '07: %s' % commits[6][1]) + self.assertEqual(next(lines).text, f'07: {commits[6][1]}') if filter_migration_warnings: self.assertSummary(next(lines).text, 'sandbox', '+', ['board4']) else: @@ -571,16 +571,15 @@ class TestBuild(unittest.TestCase): 'sandbox']), ({'all': ['board4'], 'sandbox': ['board4']}, [])) def CheckDirs(self, build, dirname): - self.assertEqual('base%s' % dirname, build.get_output_dir(1)) - self.assertEqual('base%s/fred' % dirname, - build.get_build_dir(1, 'fred')) - self.assertEqual('base%s/fred/done' % dirname, + self.assertEqual(f'base{dirname}', build.get_output_dir(1)) + self.assertEqual(f'base{dirname}/fred', build.get_build_dir(1, 'fred')) + self.assertEqual(f'base{dirname}/fred/done', build.get_done_file(1, 'fred')) - self.assertEqual('base%s/fred/u-boot.sizes' % dirname, + self.assertEqual(f'base{dirname}/fred/u-boot.sizes', build.get_func_sizes_file(1, 'fred', 'u-boot')) - self.assertEqual('base%s/fred/u-boot.objdump' % dirname, + self.assertEqual(f'base{dirname}/fred/u-boot.objdump', build.get_objdump_file(1, 'fred', 'u-boot')) - self.assertEqual('base%s/fred/err' % dirname, + self.assertEqual(f'base{dirname}/fred/err', build.get_err_file(1, 'fred')) def testOutputDir(self): @@ -589,7 +588,7 @@ class TestBuild(unittest.TestCase): build.commits = self.commits build.commit_count = len(self.commits) subject = self.commits[1].subject.translate(builder.trans_valid_chars) - dirname ='/%02d_g%s_%s' % (2, commits[1][0], subject[:20]) + dirname = f'/{2:02d}_g{commits[1][0]}_{subject[:20]}' self.CheckDirs(build, dirname) def testOutputDirCurrent(self):