Rev 4810: Cleanup smart imports. in file:///home/vila/src/bzr/bugs/516183-test-server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Feb 3 14:19:04 GMT 2010


At file:///home/vila/src/bzr/bugs/516183-test-server/

------------------------------------------------------------
revno: 4810
revision-id: v.ladeuil+lp at free.fr-20100203141903-a6u3bmyldmjmxzwk
parent: v.ladeuil+lp at free.fr-20100203140855-yuwq660bb3jayr1d
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 516183-test-server
timestamp: Wed 2010-02-03 15:19:03 +0100
message:
  Cleanup smart imports.
  
  * bzrlib/tests/__init__.py: 
  Clean bzrlib.smart imports to avoid polluting the name space (to
  be able to introduce a bzrlib.test.server module which is not
  bzrlib.smart.server).
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2010-02-02 08:36:12 +0000
+++ b/bzrlib/tests/__init__.py	2010-02-03 14:19:03 +0000
@@ -90,7 +90,11 @@
 from bzrlib.merge import merge_inner
 import bzrlib.merge3
 import bzrlib.plugin
-from bzrlib.smart import client, request, server
+from bzrlib.smart import (
+    client as _mod_smart_client,
+    request as _mod_smart_request,
+    server as _mod_smart_server,
+    )
 import bzrlib.store
 from bzrlib import symbol_versioning
 from bzrlib.symbol_versioning import (
@@ -869,7 +873,7 @@
             parent, name = hooks.known_hooks_key_to_parent_and_attribute(key)
             setattr(parent, name, factory())
         # this hook should always be installed
-        request._install_hook()
+        _mod_smart_request._install_hook()
 
     def disable_directory_isolation(self):
         """Turn off directory isolation checks."""
@@ -1043,7 +1047,8 @@
         if t.base.endswith('/work/'):
             # we have safety net/test root/work
             t = t.clone('../..')
-        elif isinstance(transport_server, server.SmartTCPServer_for_testing):
+        elif isinstance(transport_server,
+                        _mod_smart_server.SmartTCPServer_for_testing):
             # The smart server adds a path similar to work, which is traversed
             # up from by the client. But the server is chrooted - the actual
             # backing transport is not escaped from, and VFS requests to the
@@ -2057,8 +2062,7 @@
 
     def disable_verb(self, verb):
         """Disable a smart server verb for one test."""
-        from bzrlib.smart import request
-        request_handlers = request.request_handlers
+        request_handlers = _mod_smart_request.request_handlers
         orig_method = request_handlers.get(verb)
         request_handlers.remove(verb)
         def restoreVerb():
@@ -2352,7 +2356,7 @@
         return made_control.create_repository(shared=shared)
 
     def make_smart_server(self, path):
-        smart_server = server.SmartTCPServer_for_testing()
+        smart_server = _mod_smart_server.SmartTCPServer_for_testing()
         self.start_server(smart_server, self.get_server())
         remote_transport = get_transport(smart_server.get_url()).clone(path)
         return remote_transport
@@ -2388,7 +2392,7 @@
 
     def setup_smart_server_with_call_log(self):
         """Sets up a smart server as the transport server with a call log."""
-        self.transport_server = server.SmartTCPServer_for_testing
+        self.transport_server = _mod_smart_server.SmartTCPServer_for_testing
         self.hpss_calls = []
         import traceback
         # Skip the current stack down to the caller of
@@ -2397,7 +2401,7 @@
         def capture_hpss_call(params):
             self.hpss_calls.append(
                 CapturedCall(params, prefix_length))
-        client._SmartClient.hooks.install_named_hook(
+        _mod_smart_client._SmartClient.hooks.install_named_hook(
             'call', capture_hpss_call, None)
 
     def reset_smart_call_log(self):



More information about the bazaar-commits mailing list