Mercurial > python-hglib
annotate tests/test-branch.py @ 117:59cb26bf866e
error: show more info on CommandError's __str__
Sometimes stderr doesn't contain anything which makes the current
__str__ useless. We now return a tuple of (exit code, output, error).
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Fri, 14 Jun 2013 18:36:56 +0300 |
parents | f1af31960414 |
children | 1b47146a4a2c |
rev | line source |
---|---|
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 import common |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 import hglib |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 class test_branch(common.basetest): |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
5 def test_empty(self): |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
6 self.assertEquals(self.client.branch(), 'default') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
7 |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 def test_basic(self): |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
9 self.assertEquals(self.client.branch('foo'), 'foo') |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 self.append('a', 'a') |
15
f1af31960414
client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
11 rev, node = self.client.commit('first', addremove=True) |
f1af31960414
client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
12 |
f1af31960414
client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
13 rev = self.client.log(node)[0] |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
14 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
15 self.assertEquals(rev.branch, 'foo') |
12
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
16 self.assertEquals(self.client.branches(), |
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
17 [(rev.branch, int(rev.rev), rev.node[:12])]) |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
18 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
19 def test_reset_with_name(self): |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
20 self.assertRaises(ValueError, self.client.branch, 'foo', clean=True) |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
21 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
22 def test_reset(self): |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
23 self.client.branch('foo') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
24 self.assertEquals(self.client.branch(clean=True), 'default') |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
25 |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
26 def test_exists(self): |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
27 self.append('a', 'a') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
28 self.client.commit('first', addremove=True) |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
29 self.client.branch('foo') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
30 self.append('a', 'a') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
31 self.client.commit('second') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
32 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
33 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
34 def test_force(self): |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
35 self.append('a', 'a') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
36 self.client.commit('first', addremove=True) |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
37 self.client.branch('foo') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
38 self.append('a', 'a') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
39 self.client.commit('second') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
40 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
41 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
42 self.assertEquals(self.client.branch('default', force=True), 'default') |