mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
test: Remove dependency on Python 2
Python 2 is approaching end of life, and we only need it to run the mail_diff test utility. This patch updates mail_diff to run on Python 3, which only needed minor changes.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
This directory holds end to end tests, written usually in a combination of
|
This directory holds end to end tests, written usually in a combination of
|
||||||
shell and some Python.
|
shell and some Python 3.
|
||||||
|
|
||||||
They're not expected to be portable, as that gets impractical very quickly.
|
They're not expected to be portable, as that gets impractical very quickly.
|
||||||
They also have some dependencies, listed below.
|
They also have some dependencies, listed below.
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ Message-ID: <booooo>
|
|||||||
|
|
||||||
Ñañañañaña!
|
Ñañañañaña!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,4 +63,5 @@ Message-Id: <booooo>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--???????????--
|
--???????????--
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
import email.parser
|
import email.parser
|
||||||
@@ -71,7 +71,7 @@ def msg_equals(expected, msg):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if expected.is_multipart():
|
if expected.is_multipart():
|
||||||
for exp, got in itertools.izip_longest(expected.get_payload(), msg.get_payload()):
|
for exp, got in itertools.zip_longest(expected.get_payload(), msg.get_payload()):
|
||||||
if not msg_equals(exp, got):
|
if not msg_equals(exp, got):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@@ -90,8 +90,6 @@ if __name__ == "__main__":
|
|||||||
f1, f2 = sys.argv[1:3]
|
f1, f2 = sys.argv[1:3]
|
||||||
|
|
||||||
expected = email.parser.Parser().parse(open(f1))
|
expected = email.parser.Parser().parse(open(f1))
|
||||||
|
msg = email.parser.Parser().parse(open(f2))
|
||||||
mbox = mailbox.mbox(f2, create=False)
|
|
||||||
msg = mbox[0]
|
|
||||||
|
|
||||||
sys.exit(0 if msg_equals(expected, msg) else 1)
|
sys.exit(0 if msg_equals(expected, msg) else 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user