diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-02-15 09:50:46 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-02-15 09:50:46 +0100 |
commit | dbf8429a76013f48fbfa365c1b8f53b4e68acf1d (patch) | |
tree | cc976a71c2f339c698bd0e768de9242e36ec564a | |
parent | 106fd424de7954b57512cef4c4c2c2c21622ecb0 (diff) | |
download | logilab-common-dbf8429a76013f48fbfa365c1b8f53b4e68acf1d.tar.gz |
fix umessages test w/ python 3 and LC_ALL=C (closes #119967)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | test/unittest_umessage.py | 10 |
2 files changed, 15 insertions, 3 deletions
@@ -5,7 +5,13 @@ ChangeLog for logilab.common * testlib: check for generators in with_tempdir (closes #117533) * registry: - * remove 2 accidentally introduced tabs breaking python 3 compat (closes #117580) + * select_or_none should not silent ObjectNotFound exception + (closes #119819) + * remove 2 accidentally introduced tabs breaking python 3 compat + (closes #117580) + + * fix umessages test w/ python 3 and LC_ALL=C (closes #119967, report and + patch by Ian Delaney) 2013-01-21 -- 0.59.0 diff --git a/test/unittest_umessage.py b/test/unittest_umessage.py index 6bf56c6..edd7633 100644 --- a/test/unittest_umessage.py +++ b/test/unittest_umessage.py @@ -16,6 +16,7 @@ # # You should have received a copy of the GNU Lesser General Public License along # with logilab-common. If not, see <http://www.gnu.org/licenses/>. +import sys import email from os.path import join, dirname, abspath @@ -27,9 +28,14 @@ DATA = join(dirname(abspath(__file__)), 'data') class UMessageTC(TestCase): def setUp(self): - msg1 = email.message_from_file(open(join(DATA, 'test1.msg'))) + if sys.version_info >= (3, 2): + import io + msg1 = email.message_from_file(io.open(join(DATA, 'test1.msg'), encoding='utf8')) + msg2 = email.message_from_file(io.open(join(DATA, 'test2.msg'), encoding='utf8')) + else: + msg1 = email.message_from_file(open(join(DATA, 'test1.msg'))) + msg2 = email.message_from_file(open(join(DATA, 'test2.msg'))) self.umessage1 = UMessage(msg1) - msg2 = email.message_from_file(open(join(DATA, 'test2.msg'))) self.umessage2 = UMessage(msg2) def test_get_subject(self): |