:p
atchew
Login
email.policy was added in 3.6. Do not use it unless available. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- tests/test_tags.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_tags.py b/tests/test_tags.py index XXXXXXX..XXXXXXX 100755 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -XXX,XX +XXX,XX @@ class ImportTest(PatchewTestCase): self.cli_import("0028-tags-need-8bit-encoding.mbox.gz") self.cli_logout() mbox = self.client.get('/QEMU/20181126152836.25379-1-rkagan@virtuozzo.com/mbox') - parser = email.parser.BytesParser(policy=email.policy.SMTP) + try: + import email.policy + parser = email.parser.BytesParser(policy=email.policy.SMTP) + except ModuleNotFoundError: + parser = email.parser.BytesParser() msg = parser.parsebytes(mbox.content) payload = decode_payload(msg) self.assertIn('SynICState *synic = get_synic(cs);', payload) -- 2.19.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel
Older versions of Python require importing subpackages explicitly; you cannot just import the parent and look for subpackages using dot notation. Fix this. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- tests/test_tags.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_tags.py b/tests/test_tags.py index XXXXXXX..XXXXXXX 100755 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -XXX,XX +XXX,XX @@ import os sys.path.append(os.path.dirname(__file__)) from tests.patchewtest import PatchewTestCase, main import email +import email.parser +import email.policy from mbox import decode_payload class ImportTest(PatchewTestCase): -- 2.19.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel