/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_log.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
                # Always return our own log formatter
78
78
                return self.log_catcher
79
79
 
80
 
        orig = log.log_formatter_registry.get_default
81
 
        def restore():
82
 
            log.log_formatter_registry.get_default = orig
83
 
        self.addCleanup(restore)
84
 
 
 
80
        self.addAttrCleanup(log.log_formatter_registry, 'get_default')
85
81
        def getme(branch):
86
82
                # Always return our own log formatter class hijacking the
87
83
                # default behavior (which requires setting up a config
611
607
 
612
608
    def setUp(self):
613
609
        super(TestLogEncodings, self).setUp()
614
 
        self.user_encoding = osutils._cached_user_encoding
615
 
        def restore():
616
 
            osutils._cached_user_encoding = self.user_encoding
617
 
        self.addCleanup(restore)
 
610
        self.addAttrCleanup(osutils, '_cached_user_encoding')
618
611
 
619
612
    def create_branch(self):
620
613
        bzr = self.run_bzr