comparison tests/test_fetch_command.py @ 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 312f36a425f0
children f9014e28721b
comparison
equal deleted inserted replaced
923:847953806c77 924:e252f9355933
6 6
7 from mercurial import commands 7 from mercurial import commands
8 from mercurial import hg 8 from mercurial import hg
9 from mercurial import node 9 from mercurial import node
10 from mercurial import ui 10 from mercurial import ui
11 from mercurial import encoding
11 12
12 class TestBasicRepoLayout(test_util.TestBase): 13 class TestBasicRepoLayout(test_util.TestBase):
13 14
14 def test_no_dates(self): 15 def test_no_dates(self):
15 repo = self._load_fixture_and_fetch('test_no_dates.svndump') 16 repo = self._load_fixture_and_fetch('test_no_dates.svndump')
187 self.assertMultiLineEqual(open(fixturepaths[0]).read(), 188 self.assertMultiLineEqual(open(fixturepaths[0]).read(),
188 open(fixturepaths[1]).read()) 189 open(fixturepaths[1]).read())
189 190
190 def test_invalid_message(self): 191 def test_invalid_message(self):
191 repo = self._load_fixture_and_fetch('invalid_utf8.tar.gz') 192 repo = self._load_fixture_and_fetch('invalid_utf8.tar.gz')
192 self.assertEqual(repo[0].description().decode('utf8'), 193 # changelog returns descriptions in local encoding
194 desc = encoding.fromlocal(repo[0].description())
195 self.assertEqual(desc.decode('utf8'),
193 u'bl\xe5b\xe6rgr\xf8d') 196 u'bl\xe5b\xe6rgr\xf8d')
194 197
195 198
196 class TestStupidPull(test_util.TestBase): 199 class TestStupidPull(test_util.TestBase):
197 def test_stupid(self): 200 def test_stupid(self):