1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
from bzrlib.selftest.blackbox import ExternalBase
from unittest import makeSuite
import os.path
class TestBzrTools(ExternalBase):
@staticmethod
def touch(filename):
file(filename, 'wb').write('')
def test_clean_tree(self):
self.runbzr('init')
self.touch('name')
self.touch('name~')
assert os.path.lexists('name~')
self.touch('name.pyc')
self.runbzr('clean-tree')
assert os.path.lexists('name~')
assert not os.path.lexists('name')
self.runbzr('clean-tree --detritus')
assert not os.path.lexists('name~')
assert os.path.lexists('name.pyc')
self.runbzr('clean-tree --ignored')
assert not os.path.lexists('name.pyc')
def test_shelve(self):
self.runbzr('init')
self.runbzr('commit -m uc --unchanged')
self.runbzr('shelve -r 1 -m foo', retcode=0)
def test_fetch_ghosts(self):
self.runbzr('init')
try:
self.runbzr('fetch-ghosts .', retcode=1)
except AssertionError:
self.runbzr('fetch-ghosts .', retcode=3)
def test_patch(self):
self.runbzr('init')
file('myfile', 'wb').write('hello')
self.runbzr('add')
self.runbzr('commit -m hello')
file('myfile', 'wb').write('goodbye')
file('mypatch', 'wb').write(self.runbzr('diff', retcode=1, backtick=1))
self.runbzr('revert')
assert file('myfile', 'rb').read() == 'hello'
self.runbzr('patch mypatch')
assert file('myfile', 'rb').read() == 'goodbye'
def test_suite():
return makeSuite(TestBzrTools)
|