comparison tests/test_log.py @ 219:8341f2494b3f

hglib tests: migrate away from (unmaintained) nose
author Mathias De Mare <mathias.de_mare@nokia.com>
date Wed, 08 Mar 2023 17:04:58 +0100
parents tests/test-log.py@2d0ec6097d78
children a2afbf236ca8
comparison
equal deleted inserted replaced
218:934608d4fcba 219:8341f2494b3f
1 from tests import common
2 import hglib
3 from hglib.util import b
4
5 class test_log(common.basetest):
6 def test_basic(self):
7 self.append('a', 'a')
8 rev0, node0 = self.client.commit(b('first'), addremove=True)
9 self.append('a', 'a')
10 rev1, node1 = self.client.commit(b('second'))
11
12 revs = self.client.log()
13 revs.reverse()
14
15 self.assertTrue(len(revs) == 2)
16 self.assertEquals(revs[1].node, node1)
17
18 self.assertEquals(revs[0], self.client.log(b('0'))[0])
19 self.assertEquals(self.client.log(), self.client.log(files=[b('a')]))
20
21 self.assertEquals(self.client.log(), self.client.log(hidden=True))
22
23 def test_dash_in_filename(self):
24 self.append('-a', '-a')
25 self.client.commit(b('first'), addremove=True)
26 revs = self.client.log(files=[b('-a')])
27 self.assertTrue(len(revs) == 1)
28 self.assertEquals(revs[0].rev, b('0'))
29
30 def test_empty_short_option(self):
31 self.append('foobar', 'foobar')
32 self.client.commit(b('first'), addremove=True)
33 revs = self.client.log(keyword=b(''), files=[b('foobar')])
34 self.assertTrue(len(revs) == 1)
35 self.assertEquals(revs[0].rev, b('0'))
36
37 # def test_errors(self):
38 # self.assertRaisesRegexp(CommandError, 'abort: unknown revision',
39 # self.client.log, 'foo')
40 # self.append('a', 'a')
41 # self.client.commit('first', addremove=True)
42 # self.assertRaisesRegexp(CommandError,
43 # 'abort: unknown revision',
44 # self.client.log, 'bar')