Mercurial > python-hglib
annotate tests/test-summary.py @ 165:dbb21a4c0eb9 1.8
tests: fix test-summary for python3
We get back bytes, not str. Sorry about that.
author | Julien Cristau <julien.cristau@logilab.fr> |
---|---|
date | Tue, 01 Sep 2015 10:07:43 +0200 |
parents | 568bca4ff58e |
children | 9062a6b935ad |
rev | line source |
---|---|
148
c1b966866ed7
hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents:
143
diff
changeset
|
1 from tests import common |
51 | 2 import hglib |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
3 from hglib.util import b |
51 | 4 |
5 class test_summary(common.basetest): | |
6 def test_empty(self): | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
7 d = {b('parent') : [(-1, b('000000000000'), b('tip'), None)], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
8 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
9 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
10 b('update') : 0} |
51 | 11 |
12 self.assertEquals(self.client.summary(), d) | |
13 | |
14 def test_basic(self): | |
15 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
16 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 17 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
18 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
19 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
20 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
21 b('update') : 0} |
164
568bca4ff58e
tests: update test-summary for mercurial 3.5
Julien Cristau <julien.cristau@logilab.fr>
parents:
148
diff
changeset
|
22 if self.client.version >= (3, 5): |
165
dbb21a4c0eb9
tests: fix test-summary for python3
Julien Cristau <julien.cristau@logilab.fr>
parents:
164
diff
changeset
|
23 d[b('phases')] = b('1 draft') |
51 | 24 |
25 self.assertEquals(self.client.summary(), d) | |
26 | |
27 def test_commit_dirty(self): | |
28 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
29 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 30 self.append('a', 'a') |
31 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
32 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
33 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
34 b('commit') : False, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
35 b('update') : 0} |
164
568bca4ff58e
tests: update test-summary for mercurial 3.5
Julien Cristau <julien.cristau@logilab.fr>
parents:
148
diff
changeset
|
36 if self.client.version >= (3, 5): |
165
dbb21a4c0eb9
tests: fix test-summary for python3
Julien Cristau <julien.cristau@logilab.fr>
parents:
164
diff
changeset
|
37 d[b('phases')] = b('1 draft') |
51 | 38 |
39 self.assertEquals(self.client.summary(), d) | |
40 | |
41 def test_update(self): | |
42 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
43 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 44 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
45 self.client.commit(b('second')) |
51 | 46 self.client.update(0) |
47 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
48 d = {b('parent') : [(0, node[:12], None, b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
49 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
50 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
51 b('update') : 1} |
164
568bca4ff58e
tests: update test-summary for mercurial 3.5
Julien Cristau <julien.cristau@logilab.fr>
parents:
148
diff
changeset
|
52 if self.client.version >= (3, 5): |
165
dbb21a4c0eb9
tests: fix test-summary for python3
Julien Cristau <julien.cristau@logilab.fr>
parents:
164
diff
changeset
|
53 d[b('phases')] = b('2 draft') |
51 | 54 |
55 self.assertEquals(self.client.summary(), d) | |
56 | |
57 def test_remote(self): | |
58 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
59 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 60 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
61 self.client.clone(dest=b('other')) |
51 | 62 other = hglib.open('other') |
63 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
64 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
65 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
66 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
67 b('update') : 0, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
68 b('remote') : (0, 0, 0, 0)} |
51 | 69 |
70 self.assertEquals(other.summary(remote=True), d) | |
71 | |
72 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
73 self.client.commit(b('second')) |
51 | 74 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
75 d[b('remote')] = (1, 0, 0, 0) |
51 | 76 self.assertEquals(other.summary(remote=True), d) |
77 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
78 self.client.bookmark(b('bm')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
79 d[b('remote')] = (1, 1, 0, 0) |
51 | 80 self.assertEquals(other.summary(remote=True), d) |
81 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
82 other.bookmark(b('bmother')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
83 d[b('remote')] = (1, 1, 0, 1) |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
84 if self.client.version < (2, 0, 0): |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
85 d[b('parent')] = [(0, node[:12], b('tip bmother'), b('first'))] |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
86 else: |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
87 d[b('bookmarks')] = b('*bmother') |
51 | 88 self.assertEquals(other.summary(remote=True), d) |
89 | |
90 self.append('other/a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
91 rev, node = other.commit(b('second in other')) |
51 | 92 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
93 d[b('remote')] = (1, 1, 1, 1) |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
94 if self.client.version < (2, 0, 0): |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
95 tags = b('tip bmother') |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
96 else: |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
97 tags = b('tip') |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
98 d[b('parent')] = [(1, node[:12], tags, b('second in other'))] |
164
568bca4ff58e
tests: update test-summary for mercurial 3.5
Julien Cristau <julien.cristau@logilab.fr>
parents:
148
diff
changeset
|
99 if self.client.version >= (3, 5): |
165
dbb21a4c0eb9
tests: fix test-summary for python3
Julien Cristau <julien.cristau@logilab.fr>
parents:
164
diff
changeset
|
100 d[b('phases')] = b('1 draft') |
51 | 101 |
102 self.assertEquals(other.summary(remote=True), d) | |
103 | |
104 def test_two_parents(self): | |
105 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
106 rev0, node = self.client.commit(b('first'), addremove=True) |
51 | 107 |
108 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
109 rev1, node1 = self.client.commit(b('second')) |
51 | 110 |
111 self.client.update(rev0) | |
112 self.append('b', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
113 rev2, node2 = self.client.commit(b('third'), addremove=True) |
51 | 114 |
115 self.client.merge(rev1) | |
116 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
117 d = {b('parent') : [(2, node2[:12], b('tip'), b('third')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
118 (1, node1[:12], None, b('second'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
119 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
120 b('commit') : False, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
121 b('update') : 0} |
164
568bca4ff58e
tests: update test-summary for mercurial 3.5
Julien Cristau <julien.cristau@logilab.fr>
parents:
148
diff
changeset
|
122 if self.client.version >= (3, 5): |
165
dbb21a4c0eb9
tests: fix test-summary for python3
Julien Cristau <julien.cristau@logilab.fr>
parents:
164
diff
changeset
|
123 d[b('phases')] = b('3 draft') |
51 | 124 |
125 self.assertEquals(self.client.summary(), d) |