changeset 924:e252f9355933

test_fetch_command: fix if local encoding is not UTF-8 changectx.description() returns what changelog.read() returns which is a description in local encoding. Convert that back to UTF-8 before trying to decode it as UTF-8.
author Patrick Mezard <patrick@mezard.eu>
date Sun, 26 Aug 2012 19:49:47 +0200
parents 847953806c77
children 7a57289f8116
files tests/test_fetch_command.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_fetch_command.py
+++ b/tests/test_fetch_command.py
@@ -8,6 +8,7 @@ from mercurial import commands
 from mercurial import hg
 from mercurial import node
 from mercurial import ui
+from mercurial import encoding
 
 class TestBasicRepoLayout(test_util.TestBase):
 
@@ -189,7 +190,9 @@ class TestBasicRepoLayout(test_util.Test
 
     def test_invalid_message(self):
         repo = self._load_fixture_and_fetch('invalid_utf8.tar.gz')
-        self.assertEqual(repo[0].description().decode('utf8'),
+        # changelog returns descriptions in local encoding
+        desc = encoding.fromlocal(repo[0].description())
+        self.assertEqual(desc.decode('utf8'),
                          u'bl\xe5b\xe6rgr\xf8d')