~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 10:01:21 UTC
  • mfrom: (5029.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100211100121-dqc7ja698m73k3tu
(vila) Move tests servers from bzrlib.transport to
        bzrlib.tests.test_server

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    features,
65
65
    stub_sftp,
66
66
    test_lsprof,
 
67
    test_server,
67
68
    test_sftp_transport,
68
69
    TestUtil,
69
70
    )
70
71
from bzrlib.trace import note
71
 
from bzrlib.transport.memory import MemoryServer, MemoryTransport
 
72
from bzrlib.transport import memory
72
73
from bzrlib.version import _get_bzr_source_tree
73
74
 
74
75
 
622
623
 
623
624
    def test_get_readonly_url_none(self):
624
625
        from bzrlib.transport import get_transport
625
 
        from bzrlib.transport.memory import MemoryServer
626
626
        from bzrlib.transport.readonly import ReadonlyTransportDecorator
627
 
        self.vfs_transport_factory = MemoryServer
 
627
        self.vfs_transport_factory = memory.MemoryServer
628
628
        self.transport_readonly_server = None
629
629
        # calling get_readonly_transport() constructs a decorator on the url
630
630
        # for the server
639
639
    def test_get_readonly_url_http(self):
640
640
        from bzrlib.tests.http_server import HttpServer
641
641
        from bzrlib.transport import get_transport
642
 
        from bzrlib.transport.local import LocalURLServer
643
642
        from bzrlib.transport.http import HttpTransportBase
644
 
        self.transport_server = LocalURLServer
 
643
        self.transport_server = test_server.LocalURLServer
645
644
        self.transport_readonly_server = HttpServer
646
645
        # calling get_readonly_transport() gives us a HTTP server instance.
647
646
        url = self.get_readonly_url()
678
677
 
679
678
    def setUp(self):
680
679
        super(TestTestCaseTransports, self).setUp()
681
 
        self.vfs_transport_factory = MemoryServer
 
680
        self.vfs_transport_factory = memory.MemoryServer
682
681
 
683
682
    def test_make_bzrdir_preserves_transport(self):
684
683
        t = self.get_transport()
685
684
        result_bzrdir = self.make_bzrdir('subdir')
686
685
        self.assertIsInstance(result_bzrdir.transport,
687
 
                              MemoryTransport)
 
686
                              memory.MemoryTransport)
688
687
        # should not be on disk, should only be in memory
689
688
        self.failIfExists('subdir')
690
689
 
1470
1469
        # permitted.
1471
1470
        # Manually set one up (TestCase doesn't and shouldn't provide magic
1472
1471
        # machinery)
1473
 
        transport_server = MemoryServer()
 
1472
        transport_server = memory.MemoryServer()
1474
1473
        transport_server.start_server()
1475
1474
        self.addCleanup(transport_server.stop_server)
1476
1475
        t = transport.get_transport(transport_server.get_url())
1558
1557
            result.calls)
1559
1558
 
1560
1559
    def test_start_server_registers_url(self):
1561
 
        transport_server = MemoryServer()
 
1560
        transport_server = memory.MemoryServer()
1562
1561
        # A little strict, but unlikely to be changed soon.
1563
1562
        self.assertEqual([], self._bzr_selftest_roots)
1564
1563
        self.start_server(transport_server)
1805
1804
        # make_branch_and_tree has to use local branch and repositories
1806
1805
        # when the vfs transport and local disk are colocated, even if
1807
1806
        # a different transport is in use for url generation.
1808
 
        from bzrlib.transport.fakevfat import FakeVFATServer
1809
 
        self.transport_server = FakeVFATServer
 
1807
        self.transport_server = test_server.FakeVFATServer
1810
1808
        self.assertFalse(self.get_url('t1').startswith('file://'))
1811
1809
        tree = self.make_branch_and_tree('t1')
1812
1810
        base = tree.bzrdir.root_transport.base
1952
1950
        self.check_transport_set(stub_sftp.SFTPAbsoluteServer)
1953
1951
 
1954
1952
    def test_transport_memory(self):
1955
 
        self.check_transport_set(bzrlib.transport.memory.MemoryServer)
 
1953
        self.check_transport_set(memory.MemoryServer)
1956
1954
 
1957
1955
 
1958
1956
class TestSelftestWithIdList(tests.TestCaseInTempDir, SelfTestHelper):
2623
2621
        # Running bzr in blackbox mode, normal/expected/user errors should be
2624
2622
        # caught in the regular way and turned into an error message plus exit
2625
2623
        # code.
2626
 
        transport_server = MemoryServer()
 
2624
        transport_server = memory.MemoryServer()
2627
2625
        transport_server.start_server()
2628
2626
        self.addCleanup(transport_server.stop_server)
2629
2627
        url = transport_server.get_url()