~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-17 08:04:15 UTC
  • mfrom: (2423.1.2 benchmarks)
  • Revision ID: pqm@pqm.ubuntu.com-20070417080415-5vn25svmf95ki88z
Also clear SmartTCPServer hooks from TestCase._clear_hooks

Show diffs side-by-side

added added

removed removed

Lines of Context:
751
751
        self._startLogFile()
752
752
        self._benchcalls = []
753
753
        self._benchtime = None
 
754
        self._clear_hooks()
 
755
 
 
756
    def _clear_hooks(self):
754
757
        # prevent hooks affecting tests
 
758
        import bzrlib.branch
 
759
        import bzrlib.smart.server
755
760
        self._preserved_hooks = {
756
 
            bzrlib.branch.Branch:bzrlib.branch.Branch.hooks,
757
 
            bzrlib.smart.server.SmartTCPServer:bzrlib.smart.server.SmartTCPServer.hooks,
 
761
            bzrlib.branch.Branch: bzrlib.branch.Branch.hooks,
 
762
            bzrlib.smart.server.SmartTCPServer: bzrlib.smart.server.SmartTCPServer.hooks,
758
763
            }
759
764
        self.addCleanup(self._restoreHooks)
760
765
        # this list of hooks must be kept in sync with the defaults
761
766
        # in branch.py
762
767
        bzrlib.branch.Branch.hooks = bzrlib.branch.BranchHooks()
 
768
        bzrlib.smart.server.SmartTCPServer.hooks = \
 
769
            bzrlib.smart.server.SmartServerHooks()
763
770
 
764
771
    def _silenceUI(self):
765
772
        """Turn off UI for duration of test"""