You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/08/11 21:38:27 UTC

[incubator-ponymail-unit-tests] 03/03: add --fof and disregard args in yaml specs

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git

commit 72d39903e4caed89c481427bd1e53d7ec59b07fb
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Aug 11 23:34:03 2020 +0200

    add --fof and disregard args in yaml specs
    
    --fof (fail on failure) stops the suite if it hits a single error.
    Useful for quick debugging
---
 runall.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/runall.py b/runall.py
index 56c05f6..2aeda38 100644
--- a/runall.py
+++ b/runall.py
@@ -13,6 +13,8 @@ if __name__ == '__main__':
                         help="Root directory of Apache Pony Mail")
     parser.add_argument('--load', dest='load', type=str, nargs='+',
                         help="Load only specific yaml spec files instead of all test specs")
+    parser.add_argument('--fof', dest='failonfail', action='store_true',
+                        help="Stop running more tests if an error is encountered")
     args = parser.parse_args()
 
     if args.load:
@@ -25,10 +27,13 @@ if __name__ == '__main__':
     tests_total = 0
     now = time.time()
 
+    failbreak = False
     for spec_file in spec_files:
         with open(spec_file, 'r') as f:
             yml = yaml.safe_load(f)
             for test_type in yml:
+                if test_type == 'args':
+                    continue
                 tests_total += 1
                 print("Running '%s' tests from %s..." % (test_type, spec_file))
                 try:
@@ -37,6 +42,11 @@ if __name__ == '__main__':
                 except subprocess.CalledProcessError as e:
                     print("%s test from %s failed with code %d" % (test_type, spec_file, e.returncode))
                     tests_failure += 1
+                    if args.failonfail:
+                        failbreak = True
+                        break
+        if failbreak:
+            break
 
     print("-------------------------------------")
     print("Done with %u tests in %.2f seconds" % (tests_total, time.time() - now))