M mailtools/tests/test_mailer.py +2 -2
@@ 347,7 347,7 @@ class TestThreadedMailerShutdown(object)
from tempfile import NamedTemporaryFile
from subprocess import check_output
- with NamedTemporaryFile() as tmp:
+ with NamedTemporaryFile(mode="w", encoding="UTF-8") as tmp:
tmp.write(
"""
import atexit
@@ 380,5 380,5 @@ assert transport.called_at == []
tmp.flush()
output = check_output([sys.executable, tmp.name]).strip()
assert (
- output == "message sent: ('fromaddr', ['toaddr'], 'message')"
+ output == b"message sent: ('fromaddr', ['toaddr'], 'message')"
), repr(output)
M mailtools/tests/test_utils.py +3 -3
@@ 33,7 33,7 @@ def test_attachment_from_file_reads_cont
with NamedTemporaryFile(suffix=".txt") as tmp:
- tmp.write("hello world")
+ tmp.write(b"hello world")
tmp.flush()
result = attachment_from_file(tmp.name)
@@ 72,7 72,7 @@ def test_attachment_from_file_sets_filen
with NamedTemporaryFile(suffix=".txt") as tmp:
- tmp.write("hello world")
+ tmp.write(b"hello world")
tmp.flush()
result = attachment_from_file(tmp)
@@ 90,7 90,7 @@ def test_attachment_from_file_allows_fil
with NamedTemporaryFile(suffix=".txt") as tmp:
- tmp.write("hello world")
+ tmp.write(b"hello world")
tmp.flush()
result = attachment_from_file(tmp, "foo.png")