From ae3695f691c6325f1a504ee3df7f22d75c7a0c96 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 29 Apr 2025 07:21:59 -0600 Subject: patman: Move capture_sys_output() into terminal and rename This function is sometimes useful outside tests. Also it can affect how terminal output is done, e.g. whether ANSI characters should be emitted or not. Move it out of the test_util package and into terminal. Signed-off-by: Simon Glass --- tools/binman/cbfs_util_test.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tools/binman/cbfs_util_test.py') diff --git a/tools/binman/cbfs_util_test.py b/tools/binman/cbfs_util_test.py index 4c415b7ce94..2494a6b9405 100755 --- a/tools/binman/cbfs_util_test.py +++ b/tools/binman/cbfs_util_test.py @@ -20,6 +20,7 @@ from binman import bintool from binman import cbfs_util from binman.cbfs_util import CbfsWriter from binman import elf +from u_boot_pylib import terminal from u_boot_pylib import test_util from u_boot_pylib import tools @@ -314,7 +315,7 @@ class TestCbfs(unittest.TestCase): newdata = data[:-4] + struct.pack('I', 0x123) + data[pos + 4:] - with test_util.capture_sys_output() as (stdout, _stderr): + with terminal.capture() as (stdout, _stderr): cbfs_util.CbfsReader(newdata) self.assertEqual('Unknown attribute tag 123\n', stdout.getvalue()) @@ -441,7 +442,7 @@ class TestCbfs(unittest.TestCase): tag_pos = (4 + pos + cbfs_util.FILE_HEADER_LEN + cbfs_util.ATTRIBUTE_ALIGN) newdata = data[:tag_pos + 4] - with test_util.capture_sys_output() as (stdout, _stderr): + with terminal.capture() as (stdout, _stderr): with io.BytesIO(newdata) as fd: fd.seek(pos) self.assertEqual(False, cbr._read_next_file(fd)) -- cgit v1.2.3