~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_status.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-11 15:45:55 UTC
  • mfrom: (5588.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20110111154555-xmu386vs0qoigyhl
(vila) Document the packaging helper scripts. (Max Bowsher)

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
class BranchStatus(TestCaseWithTransport):
47
47
 
 
48
    def setUp(self):
 
49
        super(BranchStatus, self).setUp()
 
50
        # As TestCase.setUp clears all hooks, we install this default
 
51
        # post_status hook handler for the test.
 
52
        status.hooks.install_named_hook('post_status',
 
53
            status._show_shelve_summary,
 
54
            'bzr status')
 
55
 
48
56
    def assertStatus(self, expected_lines, working_tree,
49
57
        revision=None, short=False, pending=True, verbose=False):
50
58
        """Run status in working_tree and look for output.
203
211
        wt = self.make_branch_and_tree('.')
204
212
        b = wt.branch
205
213
 
206
 
        self.build_tree(['directory/','directory/hello.c', 'bye.c','test.c','dir2/'])
 
214
        self.build_tree(['directory/','directory/hello.c',
 
215
                         'bye.c','test.c','dir2/',
 
216
                         'missing.c'])
207
217
        wt.add('directory')
208
218
        wt.add('test.c')
209
219
        wt.commit('testing')
 
220
        wt.add('missing.c')
 
221
        unlink('missing.c')
210
222
 
211
223
        self.assertStatus([
 
224
                'missing:\n',
 
225
                '  missing.c\n',
212
226
                'unknown:\n',
213
227
                '  bye.c\n',
214
228
                '  dir2/\n',
219
233
        self.assertStatus([
220
234
                '?   bye.c\n',
221
235
                '?   dir2/\n',
 
236
                '+!  missing.c\n',
222
237
                '?   directory/hello.c\n'
223
238
                ],
224
239
                wt, short=True)
261
276
        tof.seek(0)
262
277
        self.assertEquals(tof.readlines(), ['+N  test.c\n'])
263
278
 
 
279
        tof = StringIO()
 
280
        show_tree_status(wt, specific_files=['missing.c'], to_file=tof)
 
281
        tof.seek(0)
 
282
        self.assertEquals(tof.readlines(),
 
283
                          ['missing:\n',
 
284
                           '  missing.c\n'])
 
285
 
 
286
        tof = StringIO()
 
287
        show_tree_status(wt, specific_files=['missing.c'], to_file=tof,
 
288
                         short=True)
 
289
        tof.seek(0)
 
290
        self.assertEquals(tof.readlines(),
 
291
                          ['+!  missing.c\n'])
 
292
 
264
293
    def test_specific_files_conflicts(self):
265
294
        tree = self.make_branch_and_tree('.')
266
295
        self.build_tree(['dir2/'])
530
559
        self.run_bzr(['shelve', '--all', '-m', 'foo'])
531
560
        self.build_tree(['bye.c'])
532
561
        wt.add('bye.c')
533
 
        # As TestCase.setUp clears all hooks, we install this default
534
 
        # post_status hook handler for the test.
535
 
        status.hooks.install_named_hook('post_status',
536
 
            status._show_shelve_summary,
537
 
            'bzr status')
538
562
        self.assertStatus([
539
563
                'added:\n',
540
564
                '  bye.c\n',