Mercurial > python-hglib
comparison tests/test_phase.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-phase.py@c1b966866ed7 |
children |
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_phase(common.basetest): | |
6 """test the different ways to use the phase command""" | |
7 def test_phase(self): | |
8 """test getting data from a single changeset""" | |
9 self.append('a', 'a') | |
10 rev, node0 = self.client.commit(b('first'), addremove=True) | |
11 self.assertEqual([(0, b('draft'))], self.client.phase(node0)) | |
12 ctx = self.client[rev] | |
13 self.assertEqual(b('draft'), ctx.phase()) | |
14 | |
15 def test_phase_public(self): | |
16 """test phase change from draft to public""" | |
17 self.append('a', 'a') | |
18 rev, node0 = self.client.commit(b('first'), addremove=True) | |
19 self.client.phase(node0, public=True) | |
20 self.assertEqual([(0, b('public'))], self.client.phase(node0)) | |
21 ctx = self.client[rev] | |
22 self.assertEqual(b('public'), ctx.phase()) | |
23 | |
24 def test_phase_secret(self): | |
25 """test phase change from draft to secret""" | |
26 self.append('a', 'a') | |
27 rev, node0 = self.client.commit(b('first'), addremove=True) | |
28 self.assertRaises(hglib.error.CommandError, | |
29 self.client.phase, node0, secret=True) | |
30 self.client.phase(node0, secret=True, force=True) | |
31 self.assertEqual([(0, b('secret'))], self.client.phase(node0)) | |
32 ctx = self.client[rev] | |
33 self.assertEqual(b('secret'), ctx.phase()) | |
34 | |
35 | |
36 def test_phase_multiple(self): | |
37 """test phase changes and show the phases of the different changesets""" | |
38 self.append('a', 'a') | |
39 rev, node0 = self.client.commit(b('a'), addremove=True) | |
40 self.client.phase(node0, public=True) | |
41 self.append('b', 'b') | |
42 rev, node1 = self.client.commit(b('b'), addremove=True) | |
43 self.append('c', 'c') | |
44 rev, node2 = self.client.commit(b('c'), addremove=True) | |
45 self.client.phase(node2, secret=True, force=True) | |
46 self.assertEqual([(0, b('public')), (2, b('secret')), (1, b('draft'))], | |
47 self.client.phase([node0, node2, node1])) |