From d58e674ecffe074f5210aa7300114f3fb97ed0d1 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 2 Apr 2023 12:27:57 +0300 Subject: [PATCH] test_engine: support the non-verbose output mode in get_engine_result() --- kconfig_hardened_check/test_engine.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kconfig_hardened_check/test_engine.py b/kconfig_hardened_check/test_engine.py index d04618d..0b3fca9 100644 --- a/kconfig_hardened_check/test_engine.py +++ b/kconfig_hardened_check/test_engine.py @@ -79,7 +79,7 @@ class TestEngine(unittest.TestCase): @staticmethod def get_engine_result(checklist, result, result_type): - assert(result_type in ('json', 'stdout')), \ + assert(result_type in ('json', 'stdout', 'stdout_verbose')), \ f'invalid result type "{result_type}"' if result_type == 'json': @@ -91,7 +91,10 @@ class TestEngine(unittest.TestCase): stdout_backup = sys.stdout sys.stdout = captured_output for opt in checklist: - opt.table_print('verbose', True) # verbose mode, with_results + if result_type == 'stdout_verbose': + opt.table_print('verbose', True) # verbose mode, with_results + else: + opt.table_print(None, True) # normal mode, with_results sys.stdout = stdout_backup result.append(captured_output.getvalue()) @@ -330,7 +333,7 @@ class TestEngine(unittest.TestCase): ) stdout_result = [] - self.get_engine_result(config_checklist, stdout_result, 'stdout') + self.get_engine_result(config_checklist, stdout_result, 'stdout_verbose') self.assertEqual( stdout_result, [ -- 2.31.1