diff options
author | Simon Glass <sjg@chromium.org> | 2022-01-22 15:07:28 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-09 07:07:59 +0300 |
commit | 1d0f30e936d2fabbbaa34c3904369252d54a56cc (patch) | |
tree | e8436bb0186b0acff50dc4d77879509e65dbc950 /tools/patman/test_util.py | |
parent | ce3e75dc5977e6500669fd9418405ddd4207a164 (diff) | |
download | u-boot-1d0f30e936d2fabbbaa34c3904369252d54a56cc.tar.xz |
patman: Update test_util to run doc tests
At present this function does not run the doctests. Allow the caller to
pass these modules in as strings.
Update patman to use this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/test_util.py')
-rw-r--r-- | tools/patman/test_util.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index 4e261755dc..9654e7319c 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -4,6 +4,7 @@ # from contextlib import contextmanager +import doctest import glob import multiprocessing import os @@ -139,7 +140,7 @@ def ReportResult(toolname:str, test_name: str, result: unittest.TestResult): def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes, - test_name, toolpath, test_class_list): + test_name, toolpath, class_and_module_list): """Run a series of test suites and collect the results Args: @@ -154,11 +155,13 @@ def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes, processes: Number of processes to use to run tests (None=same as #CPUs) test_name: Name of test to run, or None for all toolpath: List of paths to use for tools - test_class_list: List of test classes to run + class_and_module_list: List of test classes (type class) and module + names (type str) to run """ - for module in []: - suite = doctest.DocTestSuite(module) - suite.run(result) + for module in class_and_module_list: + if isinstance(module, str) and (not test_name or test_name == module): + suite = doctest.DocTestSuite(module) + suite.run(result) sys.argv = [sys.argv[0]] if debug: @@ -171,7 +174,9 @@ def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes, suite = unittest.TestSuite() loader = unittest.TestLoader() - for module in test_class_list: + for module in class_and_module_list: + if isinstance(module, str): + continue # Test the test module about our arguments, if it is interested if hasattr(module, 'setup_test_args'): setup_test_args = getattr(module, 'setup_test_args') |