bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
1  | 
# Copyright (C) 2005 by Canonical Ltd
 | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
2  | 
# -*- coding: utf-8 -*-
 | 
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
3  | 
|
4  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
5  | 
# it under the terms of the GNU General Public License as published by
 | 
|
6  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
7  | 
# (at your option) any later version.
 | 
|
8  | 
||
9  | 
# This program is distributed in the hope that it will be useful,
 | 
|
10  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
11  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
12  | 
# GNU General Public License for more details.
 | 
|
13  | 
||
14  | 
# You should have received a copy of the GNU General Public License
 | 
|
15  | 
# along with this program; if not, write to the Free Software
 | 
|
16  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
17  | 
||
18  | 
||
19  | 
"""Black-box tests for bzr.
 | 
|
20  | 
||
21  | 
These check that it behaves properly when it's invoked through the regular
 | 
|
22  | 
command-line interface.
 | 
|
| 
725
by Martin Pool
 doc  | 
23  | 
|
24  | 
This always reinvokes bzr through a new Python interpreter, which is a
 | 
|
25  | 
bit inefficient but arguably tests in a way more representative of how
 | 
|
26  | 
it's normally invoked.
 | 
|
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
27  | 
"""
 | 
28  | 
||
29  | 
# this code was previously in testbzr
 | 
|
30  | 
||
31  | 
from unittest import TestCase  | 
|
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
32  | 
from bzrlib.selftest import TestBase, InTempDir  | 
| 
721
by Martin Pool
 - framework for running external commands from unittest suite  | 
33  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
34  | 
|
35  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
36  | 
class ExternalBase(InTempDir):  | 
37  | 
def runbzr(self, args, retcode=0):  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
38  | 
try:  | 
39  | 
import shutil  | 
|
40  | 
from subprocess import call  | 
|
41  | 
except ImportError, e:  | 
|
42  | 
_need_subprocess()  | 
|
43  | 
            raise
 | 
|
44  | 
||
45  | 
if isinstance(args, basestring):  | 
|
46  | 
args = args.split()  | 
|
47  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
48  | 
return self.runcmd(['python', self.BZRPATH,] + args,  | 
49  | 
retcode=retcode)  | 
|
50  | 
||
51  | 
||
52  | 
||
53  | 
class TestVersion(ExternalBase):  | 
|
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
54  | 
def runTest(self):  | 
| 
721
by Martin Pool
 - framework for running external commands from unittest suite  | 
55  | 
        # output is intentionally passed through to stdout so that we
 | 
56  | 
        # can see the version being tested
 | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
57  | 
self.runbzr(['version'])  | 
| 
726
by Martin Pool
 - more rearrangement of blackbox tests  | 
58  | 
|
59  | 
||
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
60  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
61  | 
class HelpCommands(ExternalBase):  | 
| 
727
by Martin Pool
 - move more code to run external commands from testbzr to selftest  | 
62  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
63  | 
self.runbzr('--help')  | 
64  | 
self.runbzr('help')  | 
|
65  | 
self.runbzr('help commands')  | 
|
66  | 
self.runbzr('help help')  | 
|
67  | 
self.runbzr('commit -h')  | 
|
| 
727
by Martin Pool
 - move more code to run external commands from testbzr to selftest  | 
68  | 
|
69  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
70  | 
class InitBranch(ExternalBase):  | 
| 
726
by Martin Pool
 - more rearrangement of blackbox tests  | 
71  | 
def runTest(self):  | 
72  | 
import os  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
73  | 
self.runbzr(['init'])  | 
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
74  | 
|
75  | 
||
76  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
77  | 
class UserIdentity(ExternalBase):  | 
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
78  | 
def runTest(self):  | 
79  | 
        # this should always identify something, if only "john@localhost"
 | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
80  | 
self.runbzr("whoami")  | 
81  | 
self.runbzr("whoami --email")  | 
|
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
82  | 
self.assertEquals(self.backtick("bzr whoami --email").count('@'),  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
83  | 
1)  | 
84  | 
||
85  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
86  | 
class InvalidCommands(ExternalBase):  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
87  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
88  | 
self.runbzr("pants", retcode=1)  | 
89  | 
self.runbzr("--pants off", retcode=1)  | 
|
90  | 
self.runbzr("diff --message foo", retcode=1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
91  | 
|
92  | 
||
93  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
94  | 
class EmptyCommit(ExternalBase):  | 
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
95  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
96  | 
self.runbzr("init")  | 
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
97  | 
self.build_tree(['hello.txt'])  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
98  | 
self.runbzr("commit -m empty", retcode=1)  | 
99  | 
self.runbzr("add hello.txt")  | 
|
100  | 
self.runbzr("commit -m added")  | 
|
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
101  | 
|
102  | 
||
103  | 
||
| 
906
by Martin Pool
 - split out black-box ignore commands  | 
104  | 
class IgnorePatterns(ExternalBase):  | 
105  | 
def runTest(self):  | 
|
106  | 
from bzrlib.branch import Branch  | 
|
107  | 
||
108  | 
b = Branch('.', init=True)  | 
|
109  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
110  | 
||
111  | 
file('foo.tmp', 'wt').write('tmp files are ignored')  | 
|
112  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
113  | 
assert self.backtick('bzr unknowns') == ''  | 
|
114  | 
||
115  | 
file('foo.c', 'wt').write('int main() {}')  | 
|
116  | 
self.assertEquals(list(b.unknowns()), ['foo.c'])  | 
|
117  | 
assert self.backtick('bzr unknowns') == 'foo.c\n'  | 
|
118  | 
||
119  | 
self.runbzr(['add', 'foo.c'])  | 
|
120  | 
assert self.backtick('bzr unknowns') == ''  | 
|
121  | 
||
122  | 
        # 'ignore' works when creating the .bzignore file
 | 
|
123  | 
file('foo.blah', 'wt').write('blah')  | 
|
124  | 
self.assertEquals(list(b.unknowns()), ['foo.blah'])  | 
|
125  | 
self.runbzr('ignore *.blah')  | 
|
126  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
127  | 
assert file('.bzrignore', 'rb').read() == '*.blah\n'  | 
|
128  | 
||
129  | 
        # 'ignore' works when then .bzrignore file already exists
 | 
|
130  | 
file('garh', 'wt').write('garh')  | 
|
131  | 
self.assertEquals(list(b.unknowns()), ['garh'])  | 
|
132  | 
assert self.backtick('bzr unknowns') == 'garh\n'  | 
|
133  | 
self.runbzr('ignore garh')  | 
|
134  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
135  | 
assert file('.bzrignore', 'rb').read() == '*.blah\ngarh\n'  | 
|
136  | 
||
137  | 
||
138  | 
||
139  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
140  | 
class OldTests(ExternalBase):  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
141  | 
    # old tests moved from ./testbzr
 | 
142  | 
def runTest(self):  | 
|
143  | 
from os import chdir, mkdir  | 
|
144  | 
from os.path import exists  | 
|
145  | 
import os  | 
|
146  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
147  | 
runbzr = self.runbzr  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
148  | 
backtick = self.backtick  | 
149  | 
progress = self.log  | 
|
150  | 
||
151  | 
progress("basic branch creation")  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
152  | 
mkdir('branch1')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
153  | 
chdir('branch1')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
154  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
155  | 
|
156  | 
self.assertEquals(backtick('bzr root').rstrip(),  | 
|
157  | 
os.path.join(self.test_dir, 'branch1'))  | 
|
158  | 
||
159  | 
progress("status of new file")  | 
|
160  | 
||
161  | 
f = file('test.txt', 'wt')  | 
|
162  | 
f.write('hello world!\n')  | 
|
163  | 
f.close()  | 
|
164  | 
||
165  | 
out = backtick("bzr unknowns")  | 
|
| 
780
by Martin Pool
 - test message improvement  | 
166  | 
self.assertEquals(out, 'test.txt\n')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
167  | 
|
168  | 
out = backtick("bzr status")  | 
|
169  | 
assert out == 'unknown:\n test.txt\n'  | 
|
170  | 
||
171  | 
out = backtick("bzr status --all")  | 
|
172  | 
assert out == "unknown:\n test.txt\n"  | 
|
173  | 
||
174  | 
out = backtick("bzr status test.txt --all")  | 
|
175  | 
assert out == "unknown:\n test.txt\n"  | 
|
176  | 
||
177  | 
f = file('test2.txt', 'wt')  | 
|
178  | 
f.write('goodbye cruel world...\n')  | 
|
179  | 
f.close()  | 
|
180  | 
||
181  | 
out = backtick("bzr status test.txt")  | 
|
182  | 
assert out == "unknown:\n test.txt\n"  | 
|
183  | 
||
184  | 
out = backtick("bzr status")  | 
|
185  | 
assert out == ("unknown:\n"  | 
|
186  | 
" test.txt\n"  | 
|
187  | 
" test2.txt\n")  | 
|
188  | 
||
189  | 
os.unlink('test2.txt')  | 
|
190  | 
||
191  | 
progress("command aliases")  | 
|
192  | 
out = backtick("bzr st --all")  | 
|
193  | 
assert out == ("unknown:\n"  | 
|
194  | 
" test.txt\n")  | 
|
195  | 
||
196  | 
out = backtick("bzr stat")  | 
|
197  | 
assert out == ("unknown:\n"  | 
|
198  | 
" test.txt\n")  | 
|
199  | 
||
200  | 
progress("command help")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
201  | 
runbzr("help st")  | 
202  | 
runbzr("help")  | 
|
203  | 
runbzr("help commands")  | 
|
204  | 
runbzr("help slartibartfast", 1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
205  | 
|
206  | 
out = backtick("bzr help ci")  | 
|
207  | 
out.index('aliases: ')  | 
|
208  | 
||
209  | 
progress("can't rename unversioned file")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
210  | 
runbzr("rename test.txt new-test.txt", 1)  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
211  | 
|
212  | 
progress("adding a file")  | 
|
213  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
214  | 
runbzr("add test.txt")  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
215  | 
assert backtick("bzr unknowns") == ''  | 
216  | 
assert backtick("bzr status --all") == ("added:\n"  | 
|
217  | 
" test.txt\n")  | 
|
218  | 
||
219  | 
progress("rename newly-added file")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
220  | 
runbzr("rename test.txt hello.txt")  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
221  | 
assert os.path.exists("hello.txt")  | 
222  | 
assert not os.path.exists("test.txt")  | 
|
223  | 
||
224  | 
assert backtick("bzr revno") == '0\n'  | 
|
225  | 
||
226  | 
progress("add first revision")  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
227  | 
runbzr(['commit', '-m', 'add first revision'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
228  | 
|
229  | 
progress("more complex renames")  | 
|
230  | 
os.mkdir("sub1")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
231  | 
runbzr("rename hello.txt sub1", 1)  | 
232  | 
runbzr("rename hello.txt sub1/hello.txt", 1)  | 
|
233  | 
runbzr("move hello.txt sub1", 1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
234  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
235  | 
runbzr("add sub1")  | 
236  | 
runbzr("rename sub1 sub2")  | 
|
237  | 
runbzr("move hello.txt sub2")  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
238  | 
assert backtick("bzr relpath sub2/hello.txt") == os.path.join("sub2", "hello.txt\n")  | 
239  | 
||
240  | 
assert exists("sub2")  | 
|
241  | 
assert exists("sub2/hello.txt")  | 
|
242  | 
assert not exists("sub1")  | 
|
243  | 
assert not exists("hello.txt")  | 
|
244  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
245  | 
runbzr(['commit', '-m', 'commit with some things moved to subdirs'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
246  | 
|
247  | 
mkdir("sub1")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
248  | 
runbzr('add sub1')  | 
249  | 
runbzr('move sub2/hello.txt sub1')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
250  | 
assert not exists('sub2/hello.txt')  | 
251  | 
assert exists('sub1/hello.txt')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
252  | 
runbzr('move sub2 sub1')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
253  | 
assert not exists('sub2')  | 
254  | 
assert exists('sub1/sub2')  | 
|
255  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
256  | 
runbzr(['commit', '-m', 'rename nested subdirectories'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
257  | 
|
258  | 
chdir('sub1/sub2')  | 
|
259  | 
self.assertEquals(backtick('bzr root')[:-1],  | 
|
260  | 
os.path.join(self.test_dir, 'branch1'))  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
261  | 
runbzr('move ../hello.txt .')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
262  | 
assert exists('./hello.txt')  | 
263  | 
assert backtick('bzr relpath hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
264  | 
assert backtick('bzr relpath ../../sub1/sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
265  | 
runbzr(['commit', '-m', 'move to parent directory'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
266  | 
chdir('..')  | 
267  | 
assert backtick('bzr relpath sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
268  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
269  | 
runbzr('move sub2/hello.txt .')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
270  | 
assert exists('hello.txt')  | 
271  | 
||
272  | 
f = file('hello.txt', 'wt')  | 
|
273  | 
f.write('some nice new content\n')  | 
|
274  | 
f.close()  | 
|
275  | 
||
276  | 
f = file('msg.tmp', 'wt')  | 
|
277  | 
f.write('this is my new commit\n')  | 
|
278  | 
f.close()  | 
|
279  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
280  | 
runbzr('commit -F msg.tmp')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
281  | 
|
282  | 
assert backtick('bzr revno') == '5\n'  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
283  | 
runbzr('export -r 5 export-5.tmp')  | 
284  | 
runbzr('export export.tmp')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
285  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
286  | 
runbzr('log')  | 
287  | 
runbzr('log -v')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
288  | 
|
289  | 
||
290  | 
||
291  | 
progress("file with spaces in name")  | 
|
292  | 
mkdir('sub directory')  | 
|
293  | 
file('sub directory/file with spaces ', 'wt').write('see how this works\n')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
294  | 
runbzr('add .')  | 
295  | 
runbzr('diff')  | 
|
296  | 
runbzr('commit -m add-spaces')  | 
|
297  | 
runbzr('check')  | 
|
298  | 
||
299  | 
runbzr('log')  | 
|
300  | 
runbzr('log --forward')  | 
|
301  | 
||
302  | 
runbzr('info')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
303  | 
|
304  | 
||
305  | 
||
306  | 
||
307  | 
||
308  | 
||
309  | 
chdir('..')  | 
|
310  | 
chdir('..')  | 
|
311  | 
progress('branch')  | 
|
| 
907
by Martin Pool
 - try to debug blackbox branch test failure  | 
312  | 
assert os.path.exists('branch1')  | 
313  | 
assert not os.path.exists('branch2')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
314  | 
        # Can't create a branch if it already exists
 | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
315  | 
runbzr('branch branch1', retcode=1)  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
316  | 
        # Can't create a branch if its parent doesn't exist
 | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
317  | 
runbzr('branch /unlikely/to/exist', retcode=1)  | 
318  | 
runbzr('branch branch1 branch2')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
319  | 
|
320  | 
progress("pull")  | 
|
321  | 
chdir('branch1')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
322  | 
runbzr('pull', retcode=1)  | 
323  | 
runbzr('pull ../branch2')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
324  | 
chdir('.bzr')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
325  | 
runbzr('pull')  | 
326  | 
runbzr('commit --unchanged -m empty')  | 
|
327  | 
runbzr('pull')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
328  | 
chdir('../../branch2')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
329  | 
runbzr('pull')  | 
330  | 
runbzr('commit --unchanged -m empty')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
331  | 
chdir('../branch1')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
332  | 
runbzr('commit --unchanged -m empty')  | 
333  | 
runbzr('pull', retcode=1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
334  | 
chdir ('..')  | 
335  | 
||
336  | 
progress('status after remove')  | 
|
337  | 
mkdir('status-after-remove')  | 
|
338  | 
        # see mail from William Dodé, 2005-05-25
 | 
|
339  | 
        # $ bzr init; touch a; bzr add a; bzr commit -m "add a"
 | 
|
340  | 
        #     * looking for changes...
 | 
|
341  | 
        #     added a
 | 
|
342  | 
        #     * commited r1
 | 
|
343  | 
        #     $ bzr remove a
 | 
|
344  | 
        #     $ bzr status
 | 
|
345  | 
        #     bzr: local variable 'kind' referenced before assignment
 | 
|
346  | 
        #     at /vrac/python/bazaar-ng/bzrlib/diff.py:286 in compare_trees()
 | 
|
347  | 
        #     see ~/.bzr.log for debug information
 | 
|
348  | 
chdir('status-after-remove')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
349  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
350  | 
file('a', 'w').write('foo')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
351  | 
runbzr('add a')  | 
352  | 
runbzr(['commit', '-m', 'add a'])  | 
|
353  | 
runbzr('remove a')  | 
|
354  | 
runbzr('status')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
355  | 
|
356  | 
chdir('..')  | 
|
357  | 
||
358  | 
||
359  | 
||
360  | 
progress("recursive and non-recursive add")  | 
|
361  | 
mkdir('no-recurse')  | 
|
362  | 
chdir('no-recurse')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
363  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
364  | 
mkdir('foo')  | 
365  | 
fp = os.path.join('foo', 'test.txt')  | 
|
366  | 
f = file(fp, 'w')  | 
|
367  | 
f.write('hello!\n')  | 
|
368  | 
f.close()  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
369  | 
runbzr('add --no-recurse foo')  | 
370  | 
runbzr('file-id foo')  | 
|
371  | 
runbzr('file-id ' + fp, 1) # not versioned yet  | 
|
372  | 
runbzr('commit -m add-dir-only')  | 
|
373  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
374  | 
self.runbzr('file-id ' + fp, 1) # still not versioned  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
375  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
376  | 
self.runbzr('add foo')  | 
377  | 
self.runbzr('file-id ' + fp)  | 
|
378  | 
self.runbzr('commit -m add-sub-file')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
379  | 
|
380  | 
chdir('..')  | 
|
381  | 
||
382  | 
||
383  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
384  | 
class RevertCommand(ExternalBase):  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
385  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
386  | 
self.runbzr('init')  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
387  | 
|
388  | 
file('hello', 'wt').write('foo')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
389  | 
self.runbzr('add hello')  | 
390  | 
self.runbzr('commit -m setup hello')  | 
|
| 
785
by Martin Pool
 - add test for external revert command  | 
391  | 
|
392  | 
file('hello', 'wt').write('bar')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
393  | 
self.runbzr('revert hello')  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
394  | 
self.check_file_contents('hello', 'foo')  | 
395  |