~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                          TestSuite,
35
35
                          TextTestRunner,
36
36
                          )
 
37
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
37
38
from bzrlib.tests.TestUtil import _load_module_by_name
38
39
import bzrlib.errors as errors
39
40
from bzrlib import symbol_versioning
40
41
from bzrlib.symbol_versioning import zero_ten, zero_eleven
41
42
from bzrlib.trace import note
 
43
from bzrlib.transport.memory import MemoryServer, MemoryTransport
42
44
from bzrlib.version import _get_bzr_source_tree
43
45
 
44
46
 
474
476
        self.assertRaises(AssertionError, self.assertIsDirectory, 'not_here', t)
475
477
 
476
478
 
 
479
class TestTestCaseTransports(TestCaseWithTransport):
 
480
 
 
481
    def setUp(self):
 
482
        super(TestTestCaseTransports, self).setUp()
 
483
        self.transport_server = MemoryServer
 
484
 
 
485
    def test_make_bzrdir_preserves_transport(self):
 
486
        t = self.get_transport()
 
487
        result_bzrdir = self.make_bzrdir('subdir')
 
488
        self.assertIsInstance(result_bzrdir.transport, 
 
489
                              MemoryTransport)
 
490
        # should not be on disk, should only be in memory
 
491
        self.failIfExists('subdir')
 
492
 
 
493
 
477
494
class TestChrootedTest(ChrootedTestCase):
478
495
 
479
496
    def test_root_is_root(self):
729
746
        output_string = output.getvalue()
730
747
        self.assertContainsRe(output_string, "--date [0-9.]+")
731
748
        if workingtree is not None:
732
 
            revision_id = workingtree.last_revision()
 
749
            revision_id = workingtree.get_parent_ids()[0]
733
750
            self.assertEndsWith(output_string.rstrip(), revision_id)
734
751
 
735
752
 
910
927
        self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree)
911
928
 
912
929
 
 
930
class TestSFTPMakeBranchAndTree(TestCaseWithSFTPServer):
 
931
 
 
932
    def test_make_tree_for_sftp_branch(self):
 
933
        """Transports backed by local directories create local trees."""
 
934
 
 
935
        tree = self.make_branch_and_tree('t1')
 
936
        base = tree.bzrdir.root_transport.base
 
937
        self.failIf(base.startswith('sftp'),
 
938
                'base %r is on sftp but should be local' % base)
 
939
        self.assertEquals(tree.bzrdir.root_transport,
 
940
                tree.branch.bzrdir.root_transport)
 
941
        self.assertEquals(tree.bzrdir.root_transport,
 
942
                tree.branch.repository.bzrdir.root_transport)
 
943
 
 
944
 
913
945
class TestSelftest(TestCase):
914
946
    """Tests of bzrlib.tests.selftest."""
915
947