~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf_ui.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
LINES_AY = 'a\nb\nc\nd\ne\nf\ng\nh\ni\ny\n'
64
64
 
65
65
 
66
 
class ShelfTestCase(tests.TestCaseWithTransport):
 
66
class TestShelver(tests.TestCaseWithTransport):
67
67
 
68
68
    def create_shelvable_tree(self):
69
69
        tree = self.make_branch_and_tree('tree')
73
73
        self.build_tree_contents([('tree/foo', LINES_ZY)])
74
74
        return tree
75
75
 
76
 
 
77
 
class TestShelver(ShelfTestCase):
78
 
 
79
76
    def test_unexpected_prompt_failure(self):
80
77
        tree = self.create_shelvable_tree()
81
78
        tree.lock_tree_write()
193
190
        shelver.expect('Shelve adding file "foo"? [yNfq?]', 'y')
194
191
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
195
192
        shelver.run()
196
 
        self.assertPathDoesNotExist('tree/foo')
 
193
        self.failIfExists('tree/foo')
197
194
 
198
195
    def test_shelve_kind_change(self):
199
196
        tree = self.create_shelvable_tree()
311
308
                                from_revision=revision.NULL_REVISION)
312
309
        tree1.commit('Replaced root entry')
313
310
        # This is essentially assertNotRaises(InconsistentDelta)
314
 
        # With testtools 0.99, it can be rewritten as:
315
 
        # with ExpectedException(AssertionError,
316
 
        #                        'InconsistentDelta not raised'):
317
 
        #     with ExpectedException(errors.InconsistentDelta, ''):
318
 
        #         self.shelve_all(tree1, rev2)
319
 
        e = self.assertRaises(AssertionError, self.assertRaises,
320
 
                              errors.InconsistentDelta, self.shelve_all, tree1,
321
 
                              rev2)
322
 
        self.assertContainsRe('InconsistentDelta not raised', str(e))
 
311
        self.expectFailure('Cannot shelve replacing a root entry',
 
312
                           self.assertRaises, AssertionError,
 
313
                           self.assertRaises, errors.InconsistentDelta,
 
314
                           self.shelve_all, tree1, rev2)
323
315
 
324
316
    def test_shelve_split(self):
325
317
        outer_tree = self.make_branch_and_tree('outer')
335
327
                           outer_tree, rev2)
336
328
 
337
329
 
338
 
class TestApplyReporter(ShelfTestCase):
 
330
class TestApplyReporter(TestShelver):
339
331
 
340
332
    def test_shelve_not_diff(self):
341
333
        tree = self.create_shelvable_tree()
430
422
        shelver.expect('Delete file "foo"? [yNfq?]', 'y')
431
423
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
432
424
        shelver.run()
433
 
        self.assertPathDoesNotExist('tree/foo')
 
425
        self.failIfExists('tree/foo')
434
426
 
435
427
    def test_shelve_kind_change(self):
436
428
        tree = self.create_shelvable_tree()