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/01 19:17:07 UTC

[incubator-ponymail-unit-tests] branch master updated: Report parse failure instead of crashing

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 b196efb  Report parse failure instead of crashing
b196efb is described below

commit b196efb2d73ecde67b8991a968dcfb5847a187aa
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jun 1 20:16:52 2021 +0100

    Report parse failure instead of crashing
---
 tests/test-generators.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/test-generators.py b/tests/test-generators.py
index c16a10a..4068724 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -57,11 +57,15 @@ def generate_specs(args):
             message = mbox.get(key)
             lid = args.lid or archiver.normalize_lid(message.get('list-id', '??'))
             json = archie.compute_updates(fake_args, lid, False, message, message_raw)
-            gen_spec.append({
-                'index': key,
-                'message-id': message.get('message-id','').strip(),
-                'generated': json['mid'],
-            })
+            mid = message.get('message-id','').strip()
+            if json:
+                gen_spec.append({
+                    'index': key,
+                    'message-id': mid,
+                    'generated': json['mid'],
+                })
+            else:
+                print("Cannot parse index %d: %s" % (key, mid))
         yml[gen_type] = gen_spec
     with open(args.generate, 'w') as f:
         # don't sort keys here