Rev 2425: Also clear SmartTCPServer hooks from TestCase._clear_hooks in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Apr 17 09:04:18 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2425
revision-id: pqm at pqm.ubuntu.com-20070417080415-5vn25svmf95ki88z
parent: pqm at pqm.ubuntu.com-20070417070943-gzsrutg0oh9timob
parent: mbp at sourcefrog.net-20070417073847-0daboq350rqofp73
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-04-17 09:04:15 +0100
message:
  Also clear SmartTCPServer hooks from TestCase._clear_hooks
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 2423.1.2
    merged: mbp at sourcefrog.net-20070417073847-0daboq350rqofp73
    parent: mbp at sourcefrog.net-20070417065102-zabhms9y28q2ik00
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: benchmarks
    timestamp: Tue 2007-04-17 17:38:47 +1000
    message:
      Also clear SmartTCPServer hooks from TestCase._clear_hooks
    ------------------------------------------------------------
    revno: 2423.1.1
    merged: mbp at sourcefrog.net-20070417065102-zabhms9y28q2ik00
    parent: pqm at pqm.ubuntu.com-20070417005930-rofskshyjsfzrahh
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: benchmarks
    timestamp: Tue 2007-04-17 16:51:02 +1000
    message:
      fix import order dependency that broke benchmarks
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-04-13 07:02:10 +0000
+++ b/bzrlib/tests/__init__.py	2007-04-17 07:38:47 +0000
@@ -751,15 +751,22 @@
         self._startLogFile()
         self._benchcalls = []
         self._benchtime = None
+        self._clear_hooks()
+
+    def _clear_hooks(self):
         # prevent hooks affecting tests
+        import bzrlib.branch
+        import bzrlib.smart.server
         self._preserved_hooks = {
-            bzrlib.branch.Branch:bzrlib.branch.Branch.hooks,
-            bzrlib.smart.server.SmartTCPServer:bzrlib.smart.server.SmartTCPServer.hooks,
+            bzrlib.branch.Branch: bzrlib.branch.Branch.hooks,
+            bzrlib.smart.server.SmartTCPServer: bzrlib.smart.server.SmartTCPServer.hooks,
             }
         self.addCleanup(self._restoreHooks)
         # this list of hooks must be kept in sync with the defaults
         # in branch.py
         bzrlib.branch.Branch.hooks = bzrlib.branch.BranchHooks()
+        bzrlib.smart.server.SmartTCPServer.hooks = \
+            bzrlib.smart.server.SmartServerHooks()
 
     def _silenceUI(self):
         """Turn off UI for duration of test"""




More information about the bazaar-commits mailing list