~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__dirstate_helpers.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
831
831
 
832
832
    def setUp(self):
833
833
        super(TestUpdateEntry, self).setUp()
834
 
        orig = dirstate.update_entry
835
 
        def cleanup():
836
 
            dirstate.update_entry = orig
837
 
        self.addCleanup(cleanup)
838
 
        dirstate.update_entry = self.update_entry
 
834
        self.overrideAttr(dirstate, 'update_entry', self.update_entry)
839
835
 
840
836
    def get_state_with_a(self):
841
837
        """Create a DirState tracking a single object named 'a'"""
1278
1274
 
1279
1275
    def setUp(self):
1280
1276
        super(TestProcessEntry, self).setUp()
1281
 
        orig = dirstate._process_entry
1282
 
        def cleanup():
1283
 
            dirstate._process_entry = orig
1284
 
        self.addCleanup(cleanup)
1285
 
        dirstate._process_entry = self._process_entry
 
1277
        self.overrideAttr(dirstate, '_process_entry', self._process_entry)
1286
1278
 
1287
1279
    def assertChangedFileIds(self, expected, tree):
1288
1280
        tree.lock_read()
1297
1289
        # This is a direct test of bug #495023, it relies on osutils.is_inside
1298
1290
        # getting called in an inner function. Which makes it a bit brittle,
1299
1291
        # but at least it does reproduce the bug.
1300
 
        def is_inside_raises(*args, **kwargs):
1301
 
            raise RuntimeError('stop this')
1302
1292
        tree = self.make_branch_and_tree('tree')
1303
1293
        self.build_tree(['tree/file', 'tree/dir/', 'tree/dir/sub',
1304
1294
                         'tree/dir2/', 'tree/dir2/sub2'])
1307
1297
        tree.lock_read()
1308
1298
        self.addCleanup(tree.unlock)
1309
1299
        basis_tree = tree.basis_tree()
1310
 
        orig = osutils.is_inside
1311
 
        self.addCleanup(setattr, osutils, 'is_inside', orig)
1312
 
        osutils.is_inside = is_inside_raises
 
1300
        def is_inside_raises(*args, **kwargs):
 
1301
            raise RuntimeError('stop this')
 
1302
        self.overrideAttr(osutils, 'is_inside', is_inside_raises)
1313
1303
        self.assertListRaises(RuntimeError, tree.iter_changes, basis_tree)
1314
1304
 
1315
1305
    def test_simple_changes(self):