From d8318feba1ef3b2a74495ea7dca33ad1276a4ffe Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Sat, 2 Apr 2022 20:06:06 +0300 Subject: patman: test_util: Use unittest text runner to print test results The python tools' test utilities handle printing test results, but the output is quite bare compared to an ordinary unittest run. Delegate printing the results to a unittest text runner, which gives us niceties like clear separation between each test's result and how long it took to run the test suite. Unfortunately it does not print info for skipped tests by default, but this can be handled later by a custom test result subclass. It also does not print the tool name; manually print a heading that includes the toolname so that the outputs of each tool's tests are distinguishable in the CI output. Signed-off-by: Alper Nebi Yasak Reviewed-by: Simon Glass --- tools/patman/main.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tools/patman/main.py') diff --git a/tools/patman/main.py b/tools/patman/main.py index 2a2ac45709..66d4806c8d 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -12,7 +12,6 @@ import re import shutil import sys import traceback -import unittest if __name__ == "__main__": # Allow 'from patman import xxx to work' @@ -134,13 +133,12 @@ if args.cmd == 'test': import doctest from patman import func_test - result = unittest.TestResult() - test_util.run_test_suites( - result, False, False, False, None, None, None, + result = test_util.run_test_suites( + 'patman', False, False, False, None, None, None, [test_checkpatch.TestPatch, func_test.TestFunctional, 'gitutil', 'settings', 'terminal']) - sys.exit(test_util.report_result('patman', args.testname, result)) + sys.exit(0 if result.wasSuccessful() else 1) # Process commits, produce patches files, check them, email them elif args.cmd == 'send': -- cgit v1.2.3