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 2021/06/02 03:17:34 UTC

[incubator-ponymail-unit-tests] branch master updated: Allow skipping where no date: header is set

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


The following commit(s) were added to refs/heads/master by this push:
     new 23f0ffa  Allow skipping where no date: header is set
23f0ffa is described below

commit 23f0ffa74bfe627897c7b0b38d80a9c35dcb7d32
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Jun 2 05:17:18 2021 +0200

    Allow skipping where no date: header is set
---
 runall.py                | 4 ++++
 tests/test-generators.py | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/runall.py b/runall.py
index e37324c..556eec8 100755
--- a/runall.py
+++ b/runall.py
@@ -25,6 +25,8 @@ if __name__ == '__main__':
                         help = 'Skip Mboxo processing')
     parser.add_argument('--fof', dest='failonfail', action='store_true',
                         help="Stop running more tests if an error is encountered")
+    parser.add_argument('--skipnodate', dest='skipnodate', action='store_true',
+                        help="Skip generator tests with no Date: header")
     args = parser.parse_args()
 
     yamldir = args.yamldir or "yaml"
@@ -67,6 +69,8 @@ if __name__ == '__main__':
                     if args.gtype and test_type == 'generators':
                         cliargs.append('--generators')
                         cliargs.extend(args.gtype)
+                    if args.skipnodate and test_type == 'generators':
+                        cliargs.append('--skipnodate')
                     rv = subprocess.check_output(cliargs, env=env)
                     tests_success += 1
                 except subprocess.CalledProcessError as e:
diff --git a/tests/test-generators.py b/tests/test-generators.py
index 191db28..698a52c 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -120,6 +120,11 @@ def run_tests(args):
                     message_raw = _raw(args, mbox, key)
                     message = mbox.get(key)
                     msgid =(message.get('message-id') or '').strip()
+                    dateheader = message.get('date')
+                    if args.skipnodate and not dateheader:
+                        sys.stderr.write("""[SKIP] %s, index %2u: No date header found and --skipnodate specified, skipping this test!\n""" %
+                                         (gen_type, key, ))
+                        continue
                     if msgid != test['message-id']:
                         sys.stderr.write("""[SEQ?] %s, index %2u: Expected '%s', got '%s'!\n""" %
                                         (gen_type, key, test['message-id'], msgid))
@@ -158,6 +163,8 @@ def main():
                         help="Root directory of Apache Pony Mail")
     parser.add_argument('--nomboxo', dest = 'nomboxo', action='store_true',
                         help = 'Skip Mboxo processing')
+    parser.add_argument('--skipnodate', dest = 'skipnodate', action='store_true',
+                        help = 'Skip emails with no Date: header (useful for medium generator tests)')
     args = parser.parse_args()
 
     if args.rootdir: