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 bfffb5b  Allow code to work with 0.10
bfffb5b is described below

commit bfffb5b119ba35a8c90812290c1e8f48acca525e
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 15 16:12:05 2020 +0100

    Allow code to work with 0.10
---
 tests/test-generators.py | 10 ++++++++--
 tests/test-parsing.py    | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/test-generators.py b/tests/test-generators.py
index fdd253f..2c7847e 100644
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -46,7 +46,10 @@ def generate_specs(args):
                 json, _, _, _ = archie.compute_updates(fake_args, lid, False, 
message, message_raw)
             # PM <= 0.12 parameters
             else:
-                json, _, _, _ = archie.compute_updates(fake_args, lid, False, 
message)
+                try:
+                    json, _, _, _ = archie.compute_updates(lid, False, message)
+                except ValueError: # PM <= 0.10 only 2 return values
+                    json, _ = archie.compute_updates(lid, False, message)
             gen_spec.append({
                 'index': key,
                 'message-id': message.get('message-id').strip(),
@@ -101,7 +104,10 @@ def run_tests(args):
                     json, _, _, _ = archie.compute_updates(fake_args, lid, 
False, message)
                 # PM <= 0.11 parameters (missing args)
                 else:
-                    json, _, _, _ = archie.compute_updates(lid, False, message)
+                    try:
+                        json, _, _, _ = archie.compute_updates(lid, False, 
message)
+                    except ValueError: # PM <= 0.10 only 2 return values
+                        json, _ = archie.compute_updates(lid, False, message)
 
                 if json['mid'] != test['generated']:
                     errors += 1
diff --git a/tests/test-parsing.py b/tests/test-parsing.py
index 7ab0b1f..5f57c44 100644
--- a/tests/test-parsing.py
+++ b/tests/test-parsing.py
@@ -42,7 +42,10 @@ def generate_specs(args):
                 json, _, _, _ = archie.compute_updates(fake_args, lid, False, 
message)
             # PM <= 0.11 parameters (missing args)
             else:
-                json, _, _, _ = archie.compute_updates(lid, False, message)
+                try:
+                    json, _, _, _ = archie.compute_updates(lid, False, message)
+                except ValueError: # PM <= 0.10 only 2 return values
+                    json, _ = archie.compute_updates(lid, False, message)
             body_sha3_256 = None
             if json and json.get('body') is not None:
                 body_sha3_256 = 
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()
@@ -92,7 +95,10 @@ def run_tests(args):
                 json, _, _, _ = archie.compute_updates(fake_args, lid, False, 
message)
             # PM <= 0.11 parameters (missing args)
             else:
-                json, _, _, _ = archie.compute_updates(lid, False, message)
+                try:
+                    json, _, _, _ = archie.compute_updates(lid, False, message)
+                except ValueError: # PM <= 0.10 only 2 return values
+                    json, _ = archie.compute_updates(lid, False, message)
             body_sha3_256 = None
             if json and json.get('body') is not None:
                 body_sha3_256 = 
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()

Reply via email to