[PATCH hglib] tests: add test for log() method errors
Augie Fackler
raf at durin42.com
Fri Aug 2 14:39:01 CDT 2013
Got it. Looks reasonable to me. Matt?
On Jul 26, 2013, at 3:27 PM, Alexander Plavin <me at aplavin.ru> wrote:
> 2013/7/26 Augie Fackler <raf at durin42.com>:
>>
>> On Apr 27, 2013, at 5:50 AM, Alexander Plavin <me at aplavin.ru> wrote:
>>
>>> # HG changeset patch
>>> # User Alexander Plavin <me at aplavin.ru>
>>> # Date 1367066976 -14400
>>> # Node ID 0584acb30b9d7d7831cf4d74c116539c7ff9768e
>>> # Parent c635e6e7054f2600d36343eaa1770cb36549382a
>>> tests: add test for log() method errors
>>>
>>> Add test to ensure that log() raises an error when unknow revision specified.
>>> As hg log behavior with empty repo changed recently,
>>> two variants are allowed in test.
>>>
>>> diff -r c635e6e7054f -r 0584acb30b9d tests/test-log.py
>>> --- a/tests/test-log.py Fri Apr 26 01:46:08 2013 +0400
>>> +++ b/tests/test-log.py Sat Apr 27 16:49:36 2013 +0400
>>> @@ -1,3 +1,4 @@
>>> +from hglib.error import CommandError
>>> import common
>>> import hglib
>>>
>>> @@ -17,8 +18,11 @@
>>> self.assertEquals(revs[0], self.client.log('0')[0])
>>> self.assertEquals(self.client.log(), self.client.log(files=['a']))
>>>
>>> - # def test_errors(self):
>>> - # self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'foo')
>>> - # self.append('a', 'a')
>>> - # self.client.commit('first', addremove=True)
>>> - # self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'bar')
>>> \ No newline at end of file
>>> + def test_errors(self):
>>> + try:
>>> + self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'foo')
>>> + except AssertionError:
>>> + self.assertEqual(self.client.log('foo'), [])
>>
>> Not sure I understand this - in the event of an assertion error, why are we asserting that log() returns nothing? Shouldn't this command either raise or return all the time in this circumstance?
>
> There was a change in hg behaviour, and here we accept both variants.
>
>>
>>> + self.append('a', 'a')
>>> + self.client.commit('first', addremove=True)
>>> + self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'bar')
>>
>>
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel at selenic.com
>>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
More information about the Mercurial-devel
mailing list