You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/06/02 13:19:48 UTC

[incubator-ponymail-unit-tests] branch master updated: Report skipped tests

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 41baa2c  Report skipped tests
41baa2c is described below

commit 41baa2cab8b478b95f75e8fcecdfa6eab6783801
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jun 2 14:19:36 2021 +0100

    Report skipped tests
---
 runall.py                | 6 +++++-
 tests/test-generators.py | 5 ++++-
 tests/test-parsing.py    | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/runall.py b/runall.py
index 4b735cb..59df018 100755
--- a/runall.py
+++ b/runall.py
@@ -44,6 +44,7 @@ if __name__ == '__main__':
     tests_total = 0
     sub_success = 0
     sub_failure = 0
+    sub_skipped = 0
     now = time.time()
 
     failbreak = False
@@ -87,10 +88,12 @@ if __name__ == '__main__':
                         break
                 finally:
                     # Fetch successes and failures from this spec run, add to total
-                    m = re.search(r"^\[DONE\] (\d+) tests run, (\d+) failed.", rv.decode('ascii'), re.MULTILINE)
+                    m = re.search(r"^\[DONE\] (\d+) tests run, (\d+) failed\.( Skipped (\d+)\.)?", rv.decode('ascii'), re.MULTILINE)
                     if m:
                         sub_success += int(m.group(1)) - int(m.group(2))
                         sub_failure += int(m.group(2))
+                        if m.group(4) is not None:
+                            sub_skipped += int(m.group(4))
         if failbreak:
             break
 
@@ -101,6 +104,7 @@ if __name__ == '__main__':
     print("Total tests run: %4u" % (sub_success+sub_failure))
     print("Tests succeeded: %4u" % sub_success)
     print("Tests failed:    %4u" % sub_failure)
+    print("Tests skipped:   %4u" % sub_skipped)
     print("-------------------------------------")
     if tests_failure:
         sys.exit(-1)
diff --git a/tests/test-generators.py b/tests/test-generators.py
index 7bc732c..42d4ee7 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -92,6 +92,7 @@ def run_tests(args):
     except:
         import plugins.generators as generators
     errors = 0
+    skipped = 0
     tests_run = 0
     yml = yaml.safe_load(open(args.load, 'r'))
     _env = {}
@@ -136,6 +137,7 @@ def run_tests(args):
                     if args.skipnodate and not dateheader:
                         print("""[SKIP] %s, index %2u: No date header found and --skipnodate specified, skipping this test!""" %
                                          (gen_type, key, ))
+                        skipped += 1
                         continue
                     if msgid != test['message-id']:
                         sys.stderr.write("""[SEQ?] %s, index %2u: Expected '%s', got '%s'!\n""" %
@@ -162,7 +164,8 @@ def run_tests(args):
     if args.dropin and errors:
         sys.stderr.write("Writing replacement yaml as --dropin was specified\n")
         yaml.safe_dump(yml, open(args.load, "w"), sort_keys=False)
-    print("[DONE] %u tests run, %u failed." % (tests_run, errors))
+    # N.B. The following line is parsed by runall.py
+    print("[DONE] %u tests run, %u failed. Skipped %u." % (tests_run, errors, skipped))
     if errors:
         sys.exit(-1)
 
diff --git a/tests/test-parsing.py b/tests/test-parsing.py
index 4b1d8d1..88e9a68 100755
--- a/tests/test-parsing.py
+++ b/tests/test-parsing.py
@@ -127,6 +127,7 @@ def run_tests(args):
                 else:
                     print("[PASS] index %u" % (key))
         mboxfiles = []
+    # N.B. The following line is parsed by runall.py
     print("[DONE] %u tests run, %u failed." % (tests_run, errors))
     if errors:
         sys.exit(-1)