This is an automated email from the ASF dual-hosted git repository. humbedooh pushed a commit to branch 0.12 in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git
commit 44e5d60b233436ac8735ba912c79e80b5c5ba309 Author: Daniel Gruno <[email protected]> AuthorDate: Sat Aug 15 07:31:19 2020 +0200 Make calls 0.12 compatible, skip if generator is unknown to the system --- tests/test-generators.py | 8 ++++++-- tests/test-parsing.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test-generators.py b/tests/test-generators.py index 1a8f362..4e2de57 100644 --- a/tests/test-generators.py +++ b/tests/test-generators.py @@ -29,7 +29,7 @@ def generate_specs(args): message_raw = mbox.get_bytes(key) # True raw format, as opposed to calling .as_bytes() 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) + json, _, _, _ = archie.compute_updates(fake_args, lid, False, message) gen_spec.append({ 'index': key, 'message-id': message.get('message-id').strip(), @@ -43,11 +43,15 @@ def generate_specs(args): def run_tests(args): import archiver + import generators errors = 0 tests_run = 0 yml = yaml.safe_load(open(args.load, 'r')) for mboxfile, run in yml['generators'].items(): for gen_type, tests in run.items(): + if gen_type not in generators.generator_names(): + sys.stderr.write("Warning: generators.py does not have the '%s' generator, skipping tests\n" % gen_type) + continue archie = archiver.Archiver(generator=gen_type, parse_html=parse_html) mbox = mailbox.mbox(mboxfile, None, create=False) no_messages = len(mbox.keys()) @@ -60,7 +64,7 @@ def run_tests(args): message_raw = mbox.get_bytes(test['index']) # True raw format, as opposed to calling .as_bytes() message = mbox.get(test['index']) lid = args.lid or archiver.normalize_lid(message.get('list-id', '??')) - json, _, _, _ = archie.compute_updates(fake_args, lid, False, message, message_raw) + json, _, _, _ = archie.compute_updates(fake_args, lid, False, message) if json['mid'] != test['generated']: errors += 1 sys.stderr.write("""[FAIL] %s, index %u: Expected '%s', got '%s'!\n""" % diff --git a/tests/test-parsing.py b/tests/test-parsing.py index 8c0e8b1..77916b6 100644 --- a/tests/test-parsing.py +++ b/tests/test-parsing.py @@ -27,7 +27,7 @@ def generate_specs(args): message_raw = mbox.get_bytes(key) # True raw format, as opposed to calling .as_bytes() message = mbox.get(key) lid = archiver.normalize_lid(message.get('list-id', '??')) - json, _, _, _ = archie.compute_updates(fake_args, lid, False, message, message_raw) + json, _, _, _ = archie.compute_updates(fake_args, 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() @@ -62,7 +62,7 @@ def run_tests(args): message_raw = mbox.get_bytes(test['index']) # True raw format, as opposed to calling .as_bytes() message = mbox.get(test['index']) lid = archiver.normalize_lid(message.get('list-id', '??')) - json, _, _, _ = archie.compute_updates(fake_args, lid, False, message, message_raw) + json, _, _, _ = archie.compute_updates(fake_args, 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()
