From 22c2f01e90899711f7979a24777277bbfcd23bb0 Mon Sep 17 00:00:00 2001 From: Adam Dobrawy Date: Sat, 9 Apr 2016 23:01:12 +0200 Subject: [PATCH] Fix python3 compatbility in EmailMessageTestCase --- django_mailbox/tests/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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.