Reduce the size of main() by putting this code into its own function.
Signed-off-by: Simon Glass <sjg@chromium.org>
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()
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)