291
by Aaron Bentley
Adjusted to selftest -> tests change |
1 |
from bzrlib.tests.blackbox import ExternalBase |
241
by Aaron Bentley
Added blackbox tests for bzrtools |
2 |
from unittest import makeSuite |
3 |
import os.path |
|
4 |
class TestBzrTools(ExternalBase): |
|
5 |
@staticmethod
|
|
6 |
def touch(filename): |
|
7 |
file(filename, 'wb').write('') |
|
8 |
||
9 |
def test_clean_tree(self): |
|
10 |
self.runbzr('init') |
|
413
by Aaron Bentley
Update clean-tree tests for no global ignores |
11 |
self.runbzr('ignore *~') |
12 |
self.runbzr('ignore *.pyc') |
|
241
by Aaron Bentley
Added blackbox tests for bzrtools |
13 |
self.touch('name') |
14 |
self.touch('name~') |
|
15 |
assert os.path.lexists('name~') |
|
16 |
self.touch('name.pyc') |
|
17 |
self.runbzr('clean-tree') |
|
18 |
assert os.path.lexists('name~') |
|
19 |
assert not os.path.lexists('name') |
|
415.1.1
by Adeodato Simó
Make clean-tree --detritus or --ignored not delete also unknown files, |
20 |
self.touch('name') |
265
by Aaron Bentley
Fixed spelling of detritus |
21 |
self.runbzr('clean-tree --detritus') |
415.1.1
by Adeodato Simó
Make clean-tree --detritus or --ignored not delete also unknown files, |
22 |
assert os.path.lexists('name') |
241
by Aaron Bentley
Added blackbox tests for bzrtools |
23 |
assert not os.path.lexists('name~') |
24 |
assert os.path.lexists('name.pyc') |
|
25 |
self.runbzr('clean-tree --ignored') |
|
415.1.1
by Adeodato Simó
Make clean-tree --detritus or --ignored not delete also unknown files, |
26 |
assert os.path.lexists('name') |
27 |
assert not os.path.lexists('name.pyc') |
|
28 |
self.runbzr('clean-tree --unknown') |
|
29 |
assert not os.path.lexists('name') |
|
30 |
self.touch('name') |
|
31 |
self.touch('name~') |
|
32 |
self.touch('name.pyc') |
|
33 |
self.runbzr('clean-tree --unknown --ignored') |
|
34 |
assert not os.path.lexists('name') |
|
35 |
assert not os.path.lexists('name~') |
|
241
by Aaron Bentley
Added blackbox tests for bzrtools |
36 |
assert not os.path.lexists('name.pyc') |
37 |
||
38 |
def test_shelve(self): |
|
39 |
self.runbzr('init') |
|
40 |
self.runbzr('commit -m uc --unchanged') |
|
338
by Aaron Bentley
Fixed shelf test case |
41 |
self.runbzr('shelve -r 1 -m foo --all', retcode=3) |
42 |
file('foo', 'wb').write('foo') |
|
325.1.2
by Aaron Bentley
Merge shelf v2 |
43 |
self.runbzr('add foo') |
44 |
self.runbzr('commit -m foo') |
|
338
by Aaron Bentley
Fixed shelf test case |
45 |
self.runbzr('shelve -r 1 -m foo --all', retcode=0) |
241
by Aaron Bentley
Added blackbox tests for bzrtools |
46 |
|
242
by Aaron Bentley
Added tests for patch and fetch-ghosts |
47 |
def test_fetch_ghosts(self): |
48 |
self.runbzr('init') |
|
286.1.1
by Aaron Bentley
Updates to match API changes |
49 |
self.runbzr('fetch-ghosts .') |
242
by Aaron Bentley
Added tests for patch and fetch-ghosts |
50 |
|
51 |
def test_patch(self): |
|
52 |
self.runbzr('init') |
|
53 |
file('myfile', 'wb').write('hello') |
|
54 |
self.runbzr('add') |
|
55 |
self.runbzr('commit -m hello') |
|
56 |
file('myfile', 'wb').write('goodbye') |
|
271
by Aaron Bentley
Cherry-picked Robert's diff and push fixes |
57 |
file('mypatch', 'wb').write(self.runbzr('diff', retcode=1, backtick=1)) |
242
by Aaron Bentley
Added tests for patch and fetch-ghosts |
58 |
self.runbzr('revert') |
59 |
assert file('myfile', 'rb').read() == 'hello' |
|
60 |
self.runbzr('patch mypatch') |
|
61 |
assert file('myfile', 'rb').read() == 'goodbye' |
|
62 |
||
308
by Aaron Bentley
got branch-history under test |
63 |
def test_branch_history(self): |
64 |
self.runbzr('init') |
|
65 |
file('myfile', 'wb').write('hello') |
|
66 |
self.runbzr('add') |
|
67 |
self.runbzr('commit -m hello') |
|
68 |
self.runbzr('branch-history') |
|
69 |
||
309
by Aaron Bentley
Fixed graph-ancestry |
70 |
def test_branch_history(self): |
71 |
self.runbzr('init') |
|
72 |
file('myfile', 'wb').write('hello') |
|
73 |
self.runbzr('add') |
|
74 |
self.runbzr('commit -m hello') |
|
75 |
self.runbzr('graph-ancestry . graph.dot') |
|
76 |
self.runbzr('branch . my_branch') |
|
77 |
self.runbzr('graph-ancestry . graph.dot --merge-branch my_branch') |
|
242
by Aaron Bentley
Added tests for patch and fetch-ghosts |
78 |
|
310
by Aaron Bentley
Fixed fetch-ghosts |
79 |
def test_fetch_ghosts(self): |
80 |
self.runbzr('init') |
|
81 |
file('myfile', 'wb').write('hello') |
|
82 |
self.runbzr('add') |
|
83 |
self.runbzr('commit -m hello') |
|
84 |
self.runbzr('branch . my_branch') |
|
85 |
self.runbzr('fetch-ghosts my_branch') |
|
86 |
||
345
by Aaron Bentley
Added zap command |
87 |
def test_zap(self): |
88 |
self.runbzr('init source') |
|
89 |
self.runbzr('checkout --lightweight source checkout') |
|
90 |
self.runbzr('zap checkout') |
|
355.1.1
by Aaron Bentley
Provided --branch option to for zapping branches |
91 |
self.assertIs(False, os.path.exists('checkout')) |
92 |
self.assertIs(True, os.path.exists('source')) |
|
93 |
||
94 |
def test_zap_branch(self): |
|
95 |
self.runbzr('init source') |
|
96 |
self.runbzr('checkout --lightweight source checkout') |
|
407
by Aaron Bentley
Fix zap for checkouts of branches with no parents |
97 |
self.runbzr('zap --branch checkout', retcode=3) |
98 |
self.assertIs(True, os.path.exists('checkout')) |
|
99 |
self.assertIs(True, os.path.exists('source')) |
|
100 |
self.runbzr('branch source source2') |
|
101 |
self.runbzr('checkout --lightweight source2 checkout2') |
|
102 |
self.runbzr('zap --branch checkout2') |
|
103 |
self.assertIs(False, os.path.exists('checkout2')) |
|
104 |
self.assertIs(False, os.path.exists('source2')) |
|
345
by Aaron Bentley
Added zap command |
105 |
|
352
by Aaron Bentley
Added branches subcommand |
106 |
def test_branches(self): |
107 |
self.runbzr('init source') |
|
108 |
self.runbzr('init source/subsource') |
|
109 |
self.runbzr('checkout --lightweight source checkout') |
|
110 |
self.runbzr('init checkout/subcheckout') |
|
111 |
self.runbzr('init checkout/.bzr/subcheckout') |
|
112 |
out = self.capture('branches') |
|
113 |
lines = out.split('\n') |
|
114 |
self.assertIs(True, 'source' in lines) |
|
115 |
self.assertIs(True, 'source/subsource' in lines) |
|
116 |
self.assertIs(True, 'checkout/subcheckout' in lines) |
|
117 |
self.assertIs(True, 'checkout' not in lines) |
|
118 |
self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines) |
|
345
by Aaron Bentley
Added zap command |
119 |
|
377
by Aaron Bentley
Got import command working |
120 |
def test_import_upstream(self): |
121 |
self.runbzr('init source') |
|
122 |
os.mkdir('source/src') |
|
123 |
f = file('source/src/myfile', 'wb') |
|
124 |
f.write('hello?') |
|
125 |
f.close() |
|
126 |
os.chdir('source') |
|
127 |
self.runbzr('add') |
|
128 |
self.runbzr('commit -m hello') |
|
129 |
self.runbzr('export ../source-0.1.tar.gz') |
|
384
by Aaron Bentley
Implement bzip support |
130 |
self.runbzr('export ../source-0.1.tar.bz2') |
380
by Aaron Bentley
Got import working decently |
131 |
self.runbzr('init ../import') |
377
by Aaron Bentley
Got import command working |
132 |
os.chdir('../import') |
133 |
self.runbzr('import ../source-0.1.tar.gz') |
|
380
by Aaron Bentley
Got import working decently |
134 |
self.failUnlessExists('src/myfile') |
378
by Aaron Bentley
Check for modified files |
135 |
result = self.runbzr('import ../source-0.1.tar.gz', retcode=3)[1] |
136 |
self.assertContainsRe(result, 'Working tree has uncommitted changes') |
|
380
by Aaron Bentley
Got import working decently |
137 |
self.runbzr('commit -m commit') |
138 |
self.runbzr('import ../source-0.1.tar.gz') |
|
139 |
os.chdir('..') |
|
140 |
self.runbzr('init import2') |
|
141 |
self.runbzr('import source-0.1.tar.gz import2') |
|
142 |
self.failUnlessExists('import2/src/myfile') |
|
143 |
self.runbzr('import source-0.1.tar.gz import3') |
|
144 |
self.failUnlessExists('import3/src/myfile') |
|
384
by Aaron Bentley
Implement bzip support |
145 |
self.runbzr('import source-0.1.tar.bz2 import4') |
146 |
self.failUnlessExists('import4/src/myfile') |
|
377
by Aaron Bentley
Got import command working |
147 |
|
241
by Aaron Bentley
Added blackbox tests for bzrtools |
148 |
def test_suite(): |
149 |
return makeSuite(TestBzrTools) |