Browse Source

Don't print 'failed tests' if all the tests passed

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Pierre-Yves Chibon 5 years ago
parent
commit
8a39b27597
1 changed files with 16 additions and 13 deletions
  1. 16 13
      runtests.py

+ 16 - 13
runtests.py

@@ -446,17 +446,26 @@ def _run_test_suites(args, suites):
     # Gather results
     print()
     print()
-    print("Failed tests:")
-    for worker in workers:
-        if not workers[worker].failed:
-            continue
-        print("FAILED test: %s" % (worker))
+
+    if FAILED:
+        print("Failed tests:")
+        for worker in workers:
+            if not workers[worker].failed:
+                continue
+            print("FAILED test: %s" % (worker))
 
     # Write failed
     if FAILED:
         with open(os.path.join(args.results, "newfailed"), "w") as ffile:
             ffile.write(json.dumps(FAILED))
 
+    # Exit
+    outcode = 0
+    if len(FAILED) == 0:
+        print("ALL PASSED! CONGRATULATIONS!")
+    else:
+        outcode = 1
+
     # Stats
     end = time.time()
     print()
@@ -466,16 +475,10 @@ def _run_test_suites(args, suites):
         % (len(workers), (end - start), len(FAILED))
     )
 
-    # Exit
-    if len(FAILED) == 0:
-        print("ALL PASSED! CONGRATULATIONS!")
-    else:
-        return 1
-
-    if args.with_coverage:
+    if outcode == 0 and args.with_coverage:
         do_show_coverage(args)
 
-    return 0
+    return outcode
 
 
 def do_list(args):