Commits

Patrick Mézard  committed e252f93

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.

  • Participants
  • Parent commits 8479538

Comments (0)

Files changed (1)

File tests/test_fetch_command.py

 from mercurial import hg
 from mercurial import node
 from mercurial import ui
+from mercurial import encoding
 
 class TestBasicRepoLayout(test_util.TestBase):
 
 
     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')