~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-11 09:27:55 UTC
  • mfrom: (5017.3.46 test-servers)
  • mto: This revision was merged to the branch mainline in revision 5030.
  • Revision ID: v.ladeuil+lp@free.fr-20100211092755-3vvu4vbwiwjjte3s
Move tests servers from bzrlib.transport to bzrlib.tests.test_server

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
    deprecated_passed,
102
102
    )
103
103
import bzrlib.trace
104
 
from bzrlib.transport import get_transport, pathfilter
 
104
from bzrlib.transport import (
 
105
    get_transport,
 
106
    memory,
 
107
    pathfilter,
 
108
    )
105
109
import bzrlib.transport
106
 
from bzrlib.transport.local import LocalURLServer
107
 
from bzrlib.transport.memory import MemoryServer
108
 
from bzrlib.transport.readonly import ReadonlyServer
109
110
from bzrlib.trace import mutter, note
110
 
from bzrlib.tests import TestUtil
 
111
from bzrlib.tests import (
 
112
    test_server,
 
113
    TestUtil,
 
114
    )
111
115
from bzrlib.tests.http_server import HttpServer
112
116
from bzrlib.tests.TestUtil import (
113
117
                          TestSuite,
124
128
# shown frame is the test code, not our assertXYZ.
125
129
__unittest = 1
126
130
 
127
 
default_transport = LocalURLServer
 
131
default_transport = test_server.LocalURLServer
128
132
 
129
133
 
130
134
_unitialized_attr = object()
1040
1044
        if t.base.endswith('/work/'):
1041
1045
            # we have safety net/test root/work
1042
1046
            t = t.clone('../..')
1043
 
        elif isinstance(transport_server, server.SmartTCPServer_for_testing):
 
1047
        elif isinstance(transport_server,
 
1048
                        test_server.SmartTCPServer_for_testing):
1044
1049
            # The smart server adds a path similar to work, which is traversed
1045
1050
            # up from by the client. But the server is chrooted - the actual
1046
1051
            # backing transport is not escaped from, and VFS requests to the
2175
2180
        if self.__readonly_server is None:
2176
2181
            if self.transport_readonly_server is None:
2177
2182
                # readonly decorator requested
2178
 
                self.__readonly_server = ReadonlyServer()
 
2183
                self.__readonly_server = test_server.ReadonlyServer()
2179
2184
            else:
2180
2185
                # explicit readonly transport.
2181
2186
                self.__readonly_server = self.create_transport_readonly_server()
2204
2209
        is no means to override it.
2205
2210
        """
2206
2211
        if self.__vfs_server is None:
2207
 
            self.__vfs_server = MemoryServer()
 
2212
            self.__vfs_server = memory.MemoryServer()
2208
2213
            self.start_server(self.__vfs_server)
2209
2214
        return self.__vfs_server
2210
2215
 
2367
2372
        return made_control.create_repository(shared=shared)
2368
2373
 
2369
2374
    def make_smart_server(self, path):
2370
 
        smart_server = server.SmartTCPServer_for_testing()
 
2375
        smart_server = test_server.SmartTCPServer_for_testing()
2371
2376
        self.start_server(smart_server, self.get_server())
2372
2377
        remote_transport = get_transport(smart_server.get_url()).clone(path)
2373
2378
        return remote_transport
2400
2405
 
2401
2406
    def setup_smart_server_with_call_log(self):
2402
2407
        """Sets up a smart server as the transport server with a call log."""
2403
 
        self.transport_server = server.SmartTCPServer_for_testing
 
2408
        self.transport_server = test_server.SmartTCPServer_for_testing
2404
2409
        self.hpss_calls = []
2405
2410
        import traceback
2406
2411
        # Skip the current stack down to the caller of
2619
2624
            # We can only make working trees locally at the moment.  If the
2620
2625
            # transport can't support them, then we keep the non-disk-backed
2621
2626
            # branch and create a local checkout.
2622
 
            if self.vfs_transport_factory is LocalURLServer:
 
2627
            if self.vfs_transport_factory is test_server.LocalURLServer:
2623
2628
                # the branch is colocated on disk, we cannot create a checkout.
2624
2629
                # hopefully callers will expect this.
2625
2630
                local_controldir= bzrdir.BzrDir.open(self.get_vfs_only_url(relpath))
2685
2690
 
2686
2691
    def setUp(self):
2687
2692
        super(ChrootedTestCase, self).setUp()
2688
 
        if not self.vfs_transport_factory == MemoryServer:
 
2693
        if not self.vfs_transport_factory == memory.MemoryServer:
2689
2694
            self.transport_readonly_server = HttpServer
2690
2695
 
2691
2696