~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf_ui.py

Move all features to bzrlib.tests.features in 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
        finally:
306
306
            tree.unlock()
307
307
 
308
 
    def test_shelve_old_root_deleted(self):
 
308
    def test_shelve_old_root_preserved(self):
309
309
        tree1 = self.make_branch_and_tree('tree1')
310
310
        tree1.commit('add root')
 
311
        tree1_root_id = tree1.get_root_id()
311
312
        tree2 = self.make_branch_and_tree('tree2')
312
313
        rev2 = tree2.commit('add root')
 
314
        self.assertNotEquals(tree1_root_id, tree2.get_root_id())
313
315
        tree1.merge_from_branch(tree2.branch,
314
316
                                from_revision=revision.NULL_REVISION)
315
 
        tree1.commit('Replaced root entry')
 
317
        tree1.commit('merging in tree2')
 
318
        self.assertEquals(tree1_root_id, tree1.get_root_id())
316
319
        # This is essentially assertNotRaises(InconsistentDelta)
317
 
        self.expectFailure('Cannot shelve replacing a root entry',
318
 
                           self.assertRaises, AssertionError,
319
 
                           self.assertRaises, errors.InconsistentDelta,
320
 
                           self.shelve_all, tree1, rev2)
 
320
        # With testtools 0.9.9, it can be rewritten as:
 
321
        # with ExpectedException(AssertionError,
 
322
        #                        'InconsistentDelta not raised'):
 
323
        #     with ExpectedException(errors.InconsistentDelta, ''):
 
324
        #         self.shelve_all(tree1, rev2)
 
325
        e = self.assertRaises(AssertionError, self.assertRaises,
 
326
                              errors.InconsistentDelta, self.shelve_all, tree1,
 
327
                              rev2)
 
328
        self.assertContainsRe('InconsistentDelta not raised', str(e))
321
329
 
322
330
    def test_shelve_split(self):
323
331
        outer_tree = self.make_branch_and_tree('outer')