bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
1 |
# Copyright (C) 2007 David Allouche <ddaa@ddaa.net>
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Black-box tests for bzr-git."""
|
|
18 |
||
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
19 |
from dulwich.repo import ( |
20 |
Repo as GitRepo, |
|
21 |
)
|
|
22 |
||
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
23 |
import os |
24 |
||
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
25 |
from bzrlib.bzrdir import ( |
26 |
BzrDir, |
|
27 |
)
|
|
28 |
||
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
29 |
from bzrlib.tests.blackbox import ExternalBase |
|
0.200.1156
by Jelmer Vernooij
Disable push. |
30 |
from bzrlib.tests import KnownFailure |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
31 |
|
32 |
from bzrlib.plugins.git import ( |
|
33 |
tests, |
|
34 |
)
|
|
35 |
||
36 |
||
37 |
class TestGitBlackBox(ExternalBase): |
|
38 |
||
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
39 |
def simple_commit(self): |
40 |
# Create a git repository with a revision.
|
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
41 |
repo = GitRepo.init(self.test_dir) |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
42 |
builder = tests.GitBranchBuilder() |
43 |
builder.set_file('a', 'text for a\n', False) |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
44 |
r1 = builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
45 |
return repo, builder.finish()[r1] |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
46 |
|
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
47 |
def test_nick(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
48 |
GitRepo.init(self.test_dir) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
49 |
dir = BzrDir.open(self.test_dir) |
50 |
dir.create_branch() |
|
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
51 |
output, error = self.run_bzr(['nick']) |
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
52 |
self.assertEquals("HEAD\n", output) |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
53 |
|
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
54 |
def test_info(self): |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
55 |
self.simple_commit() |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
56 |
output, error = self.run_bzr(['info']) |
57 |
self.assertEqual(error, '') |
|
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
58 |
self.assertTrue("Standalone tree (format: git)" in output) |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
59 |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
60 |
def test_branch(self): |
61 |
os.mkdir("gitbranch") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
62 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
63 |
os.chdir('gitbranch') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
64 |
builder = tests.GitBranchBuilder() |
65 |
builder.set_file('a', 'text for a\n', False) |
|
66 |
builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
|
67 |
builder.finish() |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
68 |
os.chdir('..') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
69 |
|
70 |
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch']) |
|
|
0.200.171
by Jelmer Vernooij
Fix blackbox test. |
71 |
self.assertEqual(error, 'Branched 1 revision(s).\n') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
72 |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
73 |
def test_checkout(self): |
74 |
os.mkdir("gitbranch") |
|
75 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
|
76 |
os.chdir('gitbranch') |
|
77 |
builder = tests.GitBranchBuilder() |
|
78 |
builder.set_file('a', 'text for a\n', False) |
|
79 |
builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
|
80 |
builder.finish() |
|
81 |
os.chdir('..') |
|
82 |
||
83 |
output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch']) |
|
84 |
self.assertEqual(error, '') |
|
85 |
self.assertEqual(output, '') |
|
86 |
||
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
87 |
def test_branch_ls(self): |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
88 |
self.simple_commit() |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
89 |
output, error = self.run_bzr(['ls', '-r-1']) |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
90 |
self.assertEqual(error, '') |
91 |
self.assertEqual(output, "a\n") |
|
92 |
||
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
93 |
def test_init(self): |
|
0.200.1114
by Jelmer Vernooij
Properly raise exception when create_repository is called with shared=True |
94 |
self.run_bzr("init --git repo") |
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
95 |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
96 |
def test_info_verbose(self): |
97 |
self.simple_commit() |
|
98 |
||
99 |
output, error = self.run_bzr(['info', '-v']) |
|
100 |
self.assertEqual(error, '') |
|
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
101 |
self.assertTrue("Standalone tree (format: git)" in output) |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
102 |
self.assertTrue("control: Local Git Repository" in output) |
103 |
self.assertTrue("branch: Git Branch" in output) |
|
104 |
self.assertTrue("repository: Git Repository" in output) |
|
105 |
||
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
106 |
def test_push(self): |
107 |
os.mkdir("bla") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
108 |
GitRepo.init(os.path.join(self.test_dir, "bla")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
109 |
self.run_bzr(['init', 'foo']) |
110 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
|
0.200.1156
by Jelmer Vernooij
Disable push. |
111 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla'], retcode=3) |
112 |
raise KnownFailure("roundtripping is not supported") |
|
113 |
||
114 |
# when roundtripping is supported
|
|
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
115 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla']) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
116 |
self.assertEquals("", output) |
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
117 |
self.assertTrue(error.endswith("Created new branch.\n")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
118 |
|
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
119 |
def test_log(self): |
120 |
# Smoke test for "bzr log" in a git repository.
|
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
121 |
self.simple_commit() |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
122 |
|
123 |
# Check that bzr log does not fail and includes the revision.
|
|
124 |
output, error = self.run_bzr(['log']) |
|
125 |
self.assertEqual(error, '') |
|
126 |
self.assertTrue( |
|
127 |
'<The commit message>' in output, |
|
128 |
"Commit message was not found in output:\n%s" % (output,)) |
|
|
0.200.80
by Jelmer Vernooij
Add blackbox test for bzr log -v. |
129 |
|
130 |
def test_log_verbose(self): |
|
131 |
# Smoke test for "bzr log -v" in a git repository.
|
|
132 |
self.simple_commit() |
|
133 |
||
134 |
# Check that bzr log does not fail and includes the revision.
|
|
135 |
output, error = self.run_bzr(['log', '-v']) |
|
136 |
||
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
137 |
def test_tags(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
138 |
git_repo, commit_sha1 = self.simple_commit() |
|
0.200.480
by Jelmer Vernooij
Cope with API changes in Dulwich. |
139 |
git_repo.refs["refs/tags/foo"] = commit_sha1 |
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
140 |
|
141 |
output, error = self.run_bzr(['tags']) |
|
142 |
self.assertEquals(error, '') |
|
143 |
self.assertEquals(output, "foo 1\n") |
|
144 |
||
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
145 |
def test_tag(self): |
146 |
self.simple_commit() |
|
147 |
||
148 |
output, error = self.run_bzr(["tag", "bar"]) |
|
149 |
||
|
0.258.1
by Max Bowsher
Make tests tolerant to bzr <= 2.2. |
150 |
# bzr <= 2.2 emits this message in the output stream
|
151 |
# bzr => 2.3 emits this message in the error stream
|
|
152 |
self.assertEquals(error + output, 'Created tag bar.\n') |
|
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
153 |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
154 |
def test_init_repo(self): |
|
0.200.1114
by Jelmer Vernooij
Properly raise exception when create_repository is called with shared=True |
155 |
output, error = self.run_bzr(["init", "--git", "bla.git"]) |
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
156 |
self.assertEquals(error, '') |
|
0.200.1114
by Jelmer Vernooij
Properly raise exception when create_repository is called with shared=True |
157 |
self.assertEquals(output, 'Created a standalone tree (format: git)\n') |
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
158 |