aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2024-07-17 16:57:01 +0100
committerSimon Glass2024-07-26 08:01:06 -0600
commit7e68804fa39a018d7cd5b9245ec6610d8ae6b4d7 (patch)
tree512457a5234c32820d19b39164c7416ef0ac186f
parentfd35fbe22261f4f64bd83097bb10e7db323f54b9 (diff)
qconfig: Move testing into a separate function
Reduce the size of main() by putting this code into its own function. Signed-off-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-xtools/qconfig.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/qconfig.py b/tools/qconfig.py
index a33fb2aa22b..0bdabccba07 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -1521,6 +1521,16 @@ doc/develop/moveconfig.rst for documentation.'''
return parser, parser.parse_args()
+def do_tests():
+ """Run doctests and unit tests (so far there are no unit tests)"""
+ sys.argv = [sys.argv[0]]
+ fail, _ = doctest.testmod()
+ if fail:
+ return 1
+ unittest.main()
+ return 0
+
+
def main():
"""Main program"""
parser, args = parse_args()
@@ -1535,11 +1545,7 @@ def main():
args.configs = [prefix_config(cfg) for cfg in args.configs]
if args.test:
- sys.argv = [sys.argv[0]]
- fail, _ = doctest.testmod()
- if fail:
- return 1
- unittest.main()
+ return do_tests()
if args.scan_source:
do_scan_source(os.getcwd(), args.update)