~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_push.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:
275
275
    def disableOptimisticGetParentMap(self):
276
276
        # Tweak some class variables to stop remote get_parent_map calls asking
277
277
        # for or receiving more data than the caller asked for.
278
 
        old_flag = SmartServerRepositoryGetParentMap.no_extra_results
279
 
        inter_class = repository.InterRepository
280
 
        old_batch_size = inter_class._walk_to_common_revisions_batch_size
281
 
        inter_class._walk_to_common_revisions_batch_size = 1
282
 
        SmartServerRepositoryGetParentMap.no_extra_results = True
283
 
        def reset_values():
284
 
            SmartServerRepositoryGetParentMap.no_extra_results = old_flag
285
 
            inter_class._walk_to_common_revisions_batch_size = old_batch_size
286
 
        self.addCleanup(reset_values)
 
278
        self.overrideAttr(repository.InterRepository,
 
279
                          '_walk_to_common_revisions_batch_size', 1)
 
280
        self.overrideAttr(SmartServerRepositoryGetParentMap,
 
281
                          'no_extra_results', True)
287
282
 
288
283
 
289
284
class TestPushHook(TestCaseWithBranch):