# HG changeset patch # User Patrick Mezard # Date 1346003387 -7200 # Node ID e252f9355933e4e16838841f8e5cfe7b4d35a4b8 # Parent 847953806c777aab4923175793dbd2c8e6397c63 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. diff --git a/tests/test_fetch_command.py b/tests/test_fetch_command.py --- 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')