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.1267
by Jelmer Vernooij
Disable test on 2.3 which is known failing. |
25 |
from bzrlib import ( |
26 |
version_info as bzrlib_version, |
|
27 |
)
|
|
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
28 |
from bzrlib.bzrdir import ( |
29 |
BzrDir, |
|
30 |
)
|
|
31 |
||
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
32 |
from bzrlib.tests.blackbox import ExternalBase |
|
0.200.1156
by Jelmer Vernooij
Disable push. |
33 |
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. |
34 |
|
35 |
from bzrlib.plugins.git import ( |
|
36 |
tests, |
|
37 |
)
|
|
38 |
||
39 |
||
40 |
class TestGitBlackBox(ExternalBase): |
|
41 |
||
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
42 |
def simple_commit(self): |
43 |
# Create a git repository with a revision.
|
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
44 |
repo = GitRepo.init(self.test_dir) |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
45 |
builder = tests.GitBranchBuilder() |
46 |
builder.set_file('a', 'text for a\n', False) |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
47 |
r1 = builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
48 |
return repo, builder.finish()[r1] |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
49 |
|
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
50 |
def test_nick(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
51 |
GitRepo.init(self.test_dir) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
52 |
dir = BzrDir.open(self.test_dir) |
53 |
dir.create_branch() |
|
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
54 |
output, error = self.run_bzr(['nick']) |
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
55 |
self.assertEquals("HEAD\n", output) |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
56 |
|
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
57 |
def test_info(self): |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
58 |
self.simple_commit() |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
59 |
output, error = self.run_bzr(['info']) |
60 |
self.assertEqual(error, '') |
|
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
61 |
self.assertTrue("Standalone tree (format: git)" in output) |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
62 |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
63 |
def test_branch(self): |
64 |
os.mkdir("gitbranch") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
65 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
66 |
os.chdir('gitbranch') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
67 |
builder = tests.GitBranchBuilder() |
68 |
builder.set_file('a', 'text for a\n', False) |
|
69 |
builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
|
70 |
builder.finish() |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
71 |
os.chdir('..') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
72 |
|
73 |
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch']) |
|
|
0.200.171
by Jelmer Vernooij
Fix blackbox test. |
74 |
self.assertEqual(error, 'Branched 1 revision(s).\n') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
75 |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
76 |
def test_checkout(self): |
77 |
os.mkdir("gitbranch") |
|
78 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
|
79 |
os.chdir('gitbranch') |
|
80 |
builder = tests.GitBranchBuilder() |
|
81 |
builder.set_file('a', 'text for a\n', False) |
|
82 |
builder.commit('Joe Foo <joe@foo.com>', u'<The commit message>') |
|
83 |
builder.finish() |
|
84 |
os.chdir('..') |
|
85 |
||
86 |
output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch']) |
|
87 |
self.assertEqual(error, '') |
|
88 |
self.assertEqual(output, '') |
|
89 |
||
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
90 |
def test_branch_ls(self): |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
91 |
self.simple_commit() |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
92 |
output, error = self.run_bzr(['ls', '-r-1']) |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
93 |
self.assertEqual(error, '') |
94 |
self.assertEqual(output, "a\n") |
|
95 |
||
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
96 |
def test_init(self): |
|
0.200.1267
by Jelmer Vernooij
Disable test on 2.3 which is known failing. |
97 |
self.run_bzr("init --git repo") |
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
98 |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
99 |
def test_info_verbose(self): |
100 |
self.simple_commit() |
|
101 |
||
|
0.200.1267
by Jelmer Vernooij
Disable test on 2.3 which is known failing. |
102 |
if bzrlib_version < (2, 4): |
103 |
raise KnownFailure("bzr info uses inventory on bzr < 2.4") |
|
104 |
||
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
105 |
output, error = self.run_bzr(['info', '-v']) |
106 |
self.assertEqual(error, '') |
|
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
107 |
self.assertTrue("Standalone tree (format: git)" in output) |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
108 |
self.assertTrue("control: Local Git Repository" in output) |
109 |
self.assertTrue("branch: Git Branch" in output) |
|
110 |
self.assertTrue("repository: Git Repository" in output) |
|
111 |
||
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
112 |
def test_push(self): |
113 |
os.mkdir("bla") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
114 |
GitRepo.init(os.path.join(self.test_dir, "bla")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
115 |
self.run_bzr(['init', 'foo']) |
116 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
|
0.200.1156
by Jelmer Vernooij
Disable push. |
117 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla'], retcode=3) |
118 |
raise KnownFailure("roundtripping is not supported") |
|
119 |
||
120 |
# when roundtripping is supported
|
|
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
121 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla']) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
122 |
self.assertEquals("", output) |
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
123 |
self.assertTrue(error.endswith("Created new branch.\n")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
124 |
|
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
125 |
def test_log(self): |
126 |
# Smoke test for "bzr log" in a git repository.
|
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
127 |
self.simple_commit() |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
128 |
|
129 |
# Check that bzr log does not fail and includes the revision.
|
|
130 |
output, error = self.run_bzr(['log']) |
|
131 |
self.assertEqual(error, '') |
|
132 |
self.assertTrue( |
|
133 |
'<The commit message>' in output, |
|
134 |
"Commit message was not found in output:\n%s" % (output,)) |
|
|
0.200.80
by Jelmer Vernooij
Add blackbox test for bzr log -v. |
135 |
|
136 |
def test_log_verbose(self): |
|
137 |
# Smoke test for "bzr log -v" in a git repository.
|
|
138 |
self.simple_commit() |
|
139 |
||
140 |
# Check that bzr log does not fail and includes the revision.
|
|
141 |
output, error = self.run_bzr(['log', '-v']) |
|
142 |
||
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
143 |
def test_tags(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
144 |
git_repo, commit_sha1 = self.simple_commit() |
|
0.200.480
by Jelmer Vernooij
Cope with API changes in Dulwich. |
145 |
git_repo.refs["refs/tags/foo"] = commit_sha1 |
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
146 |
|
147 |
output, error = self.run_bzr(['tags']) |
|
148 |
self.assertEquals(error, '') |
|
149 |
self.assertEquals(output, "foo 1\n") |
|
150 |
||
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
151 |
def test_tag(self): |
152 |
self.simple_commit() |
|
153 |
||
154 |
output, error = self.run_bzr(["tag", "bar"]) |
|
155 |
||
|
0.258.1
by Max Bowsher
Make tests tolerant to bzr <= 2.2. |
156 |
# bzr <= 2.2 emits this message in the output stream
|
157 |
# bzr => 2.3 emits this message in the error stream
|
|
158 |
self.assertEquals(error + output, 'Created tag bar.\n') |
|
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
159 |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
160 |
def test_init_repo(self): |
|
0.200.1114
by Jelmer Vernooij
Properly raise exception when create_repository is called with shared=True |
161 |
output, error = self.run_bzr(["init", "--git", "bla.git"]) |
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
162 |
self.assertEquals(error, '') |
|
0.200.1114
by Jelmer Vernooij
Properly raise exception when create_repository is called with shared=True |
163 |
self.assertEquals(output, 'Created a standalone tree (format: git)\n') |
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
164 |