~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2006-05-18 16:36:49 UTC
  • Revision ID: abentley@panoramicfeedback.com-20060518163649-f37d1b11e4eac43e
Handle adds and removes efficiently

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
    def test_clean_tree(self):
10
10
        self.runbzr('init')
11
 
        self.runbzr('ignore *~')
12
 
        self.runbzr('ignore *.pyc')
13
11
        self.touch('name')
14
12
        self.touch('name~')
15
13
        assert os.path.lexists('name~')
17
15
        self.runbzr('clean-tree')
18
16
        assert os.path.lexists('name~')
19
17
        assert not os.path.lexists('name')
20
 
        self.touch('name')
21
18
        self.runbzr('clean-tree --detritus')
22
 
        assert os.path.lexists('name')
23
19
        assert not os.path.lexists('name~')
24
20
        assert os.path.lexists('name.pyc')
25
21
        self.runbzr('clean-tree --ignored')
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~')
36
22
        assert not os.path.lexists('name.pyc')
37
23
 
38
24
    def test_shelve(self):
94
80
    def test_zap_branch(self):
95
81
        self.runbzr('init source')
96
82
        self.runbzr('checkout --lightweight source checkout')
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'))
 
83
        self.runbzr('zap --branch checkout')
 
84
        self.assertIs(False, os.path.exists('checkout'))
 
85
        self.assertIs(False, os.path.exists('source'))
105
86
 
106
87
    def test_branches(self):
107
88
        self.runbzr('init source')
127
108
        self.runbzr('add')
128
109
        self.runbzr('commit -m hello')
129
110
        self.runbzr('export ../source-0.1.tar.gz')
130
 
        self.runbzr('export ../source-0.1.tar.bz2')
131
111
        self.runbzr('init ../import')
132
112
        os.chdir('../import')
133
113
        self.runbzr('import ../source-0.1.tar.gz')
142
122
        self.failUnlessExists('import2/src/myfile')
143
123
        self.runbzr('import source-0.1.tar.gz import3')
144
124
        self.failUnlessExists('import3/src/myfile')
145
 
        self.runbzr('import source-0.1.tar.bz2 import4')
146
 
        self.failUnlessExists('import4/src/myfile')
147
125
 
148
 
    def test_shove(self):
149
 
        self.runbzr('init source')
150
 
        f = file('source/file', 'wb')
151
 
        f.write('hello\n')
152
 
        f.close()
153
 
        self.runbzr('add source/file')
154
 
        self.runbzr('commit source -m foo')
155
 
        self.runbzr('branch source target1')
156
 
        self.runbzr('branch source target2')
157
 
        f = file('source/file', 'wb')
158
 
        f.write('goodbye\n')
159
 
        f.close()
160
 
        self.runbzr('shove target1 source')
161
 
        f = file('target1/file', 'rb')
162
 
        self.assertEqual(f.read(), 'goodbye\n')
163
 
        f.close()
164
 
        os.chdir('source')
165
 
        self.runbzr('shove target2', retcode=3)
166
 
        self.runbzr('shove ../target2')
167
 
        f = file('../target2/file', 'rb')
168
 
        self.assertEqual(f.read(), 'goodbye\n')
169
 
        f.close()
170
126
 
171
127
def test_suite():
172
128
    return makeSuite(TestBzrTools)