From nobody Fri Apr 26 10:02:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15433227426311018.8903936806827; Tue, 27 Nov 2018 04:45:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CF50308FC5A; Tue, 27 Nov 2018 12:45:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38F185D6A9; Tue, 27 Nov 2018 12:45:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2D0A2181B9E4; Tue, 27 Nov 2018 12:45:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wARCjeBL011994 for ; Tue, 27 Nov 2018 07:45:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3794626359; Tue, 27 Nov 2018 12:45:40 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 680D226357 for ; Tue, 27 Nov 2018 12:45:35 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 27 Nov 2018 13:45:34 +0100 Message-Id: <20181127124534.16725-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] tests: fix test_tags for Python < 3.6 X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 27 Nov 2018 12:45:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" email.policy was added in 3.6. Do not use it unless available. Signed-off-by: Paolo Bonzini --- 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 a49a660..9ced996 100755 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -55,7 +55,11 @@ class ImportTest(PatchewTestCase): self.cli_import("0028-tags-need-8bit-encoding.mbox.gz") self.cli_logout() mbox =3D self.client.get('/QEMU/20181126152836.25379-1-rkagan@virt= uozzo.com/mbox') - parser =3D email.parser.BytesParser(policy=3Demail.policy.SMTP) + try: + import email.policy + parser =3D email.parser.BytesParser(policy=3Demail.policy.SMTP) + except ModuleNotFoundError: + parser =3D email.parser.BytesParser() msg =3D parser.parsebytes(mbox.content) payload =3D decode_payload(msg) self.assertIn('SynICState *synic =3D get_synic(cs);', payload) --=20 2.19.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel