diff --git a/django_mailbox/tests/base.py b/django_mailbox/tests/base.py index f786b41..337cf30 100644 --- a/django_mailbox/tests/base.py +++ b/django_mailbox/tests/base.py @@ -2,6 +2,7 @@ import email import os from os.path import dirname, join import time +import six from django.conf import settings from django.test import TestCase @@ -59,7 +60,10 @@ class EmailMessageTestCase(TestCase): def _get_email_object(self, name): with open(join(dirname(__file__), 'messages', name), 'rb') as f: - return email.message_from_file(f) + if six.PY3: + return email.message_from_binary_file(f) + else: + return email.message_from_file(f) def _headers_identical(self, left, right, header=None): """ Check if headers are (close enough to) identical.