~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree_4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-26 10:49:57 UTC
  • mfrom: (4987.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100126104957-dmtqnc0pckuruyla
(vila,
        jam) Implement TestCase.overrideAttr to simplify tests setUp/cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
555
555
        tree.commit('one', rev_id='rev-1')
556
556
        # Trap osutils._walkdirs_utf8 to spy on what dirs have been accessed.
557
557
        returned = []
558
 
        orig_walkdirs = osutils._walkdirs_utf8
559
 
        def reset():
560
 
            osutils._walkdirs_utf8 = orig_walkdirs
561
 
        self.addCleanup(reset)
562
558
        def walkdirs_spy(*args, **kwargs):
563
 
            for val in orig_walkdirs(*args, **kwargs):
 
559
            for val in orig(*args, **kwargs):
564
560
                returned.append(val[0][0])
565
561
                yield val
566
 
        osutils._walkdirs_utf8 = walkdirs_spy
 
562
        orig = self.overrideAttr(osutils, '_walkdirs_utf8', walkdirs_spy)
567
563
 
568
564
        basis = tree.basis_tree()
569
565
        tree.lock_read()