From 17796728d031e7027b7d3f22a7a3c12b1413d8b0 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 16 Jun 2023 11:38:19 -0400 Subject: [PATCH] Fix stamp file creation for zap unit test. (#27296) unittest.main by default calls sys.exit so we did not get a chance to create the stamp file. Fix this and handle sys exit logic separately. Co-authored-by: Andrei Litvin --- scripts/tools/zap/test_generate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/tools/zap/test_generate.py b/scripts/tools/zap/test_generate.py index ff7ea2c20e74c2..d0ada5c22577b4 100755 --- a/scripts/tools/zap/test_generate.py +++ b/scripts/tools/zap/test_generate.py @@ -197,7 +197,9 @@ def process_arguments(): PROGRAM_ARGUMENTS = process_args - unittest.main(argv=unittest_args) + test_results = unittest.main(argv=unittest_args, exit=False) + if test_results.result.failures: + sys.exit(1) if process_args.stamp_file: open(process_args.stamp_file, "wb").close()