comparison tests/test_status.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-status.py@c1b966866ed7
children a2afbf236ca8
comparison
equal deleted inserted replaced
218:934608d4fcba 219:8341f2494b3f
1 import os
2 from tests import common
3 from hglib.util import b
4
5 class test_status(common.basetest):
6 def test_empty(self):
7 self.assertEquals(self.client.status(), [])
8
9 def test_one_of_each(self):
10 self.append('.hgignore', 'ignored')
11 self.append('ignored', 'a')
12 self.append('clean', 'a')
13 self.append('modified', 'a')
14 self.append('removed', 'a')
15 self.append('missing', 'a')
16 self.client.commit(b('first'), addremove=True)
17 self.append('modified', 'a')
18 self.append('added', 'a')
19 self.client.add([b('added')])
20 os.remove('missing')
21 self.client.remove([b('removed')])
22 self.append('untracked')
23
24 l = [(b('M'), b('modified')),
25 (b('A'), b('added')),
26 (b('R'), b('removed')),
27 (b('C'), b('.hgignore')),
28 (b('C'), b('clean')),
29 (b('!'), b('missing')),
30 (b('?'), b('untracked')),
31 (b('I'), b('ignored'))]
32
33 st = self.client.status(all=True)
34
35 for i in l:
36 self.assertTrue(i in st)
37
38 def test_copy(self):
39 self.append('source', 'a')
40 self.client.commit(b('first'), addremove=True)
41 self.client.copy(b('source'), b('dest'))
42 l = [(b('A'), b('dest')), (b(' '), b('source'))]
43 self.assertEquals(self.client.status(copies=True), l)
44
45 def test_copy_origin_space(self):
46 self.append('s ource', 'a')
47 self.client.commit(b('first'), addremove=True)
48 self.client.copy(b('s ource'), b('dest'))
49 l = [(b('A'), b('dest')), (b(' '), b('s ource'))]
50 self.assertEquals(self.client.status(copies=True), l)