~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_bzrdir/test_bzrdir.py

  • Committer: Vincent Ladeuil
  • Date: 2010-06-20 11:18:38 UTC
  • mto: (5247.1.10 first-try)
  • mto: This revision was merged to the branch mainline in revision 5326.
  • Revision ID: v.ladeuil+lp@free.fr-20100620111838-3s726ne0g2ni42m1
No more use of the get_transport imported *symbol*, all uses are through
the module now, allowing effective wrapping.

* bzrlib/workingtree.py:
(WorkingTree.find_trees): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/transport/decorator.py:
(TransportDecorator.__init__): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_workingtree.py:
(TestWorkingTreeFormat.test_find_format.check_format): More evil
calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/test_upgrade.py:
(TestUpgrade.test_upgrade_simple):
(TestUpgrade.test_upgrade_v6_to_meta_no_workingtree): More evil
calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/test_transport_log.py:
(test_log_transport): More evil calls to transport.get_transport
defeating the wrapping.

* bzrlib/tests/test_smart_request.py:
(TestJailHook.test_jail_hook): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_sftp_transport.py:
(SFTPNonServerTest.test_abspath_root_sibling_server):
(SSHVendorBadConnection.test_bad_connection_paramiko):
(SSHVendorBadConnection.test_bad_connection_ssh):
(TestUsesAuthConfig.get_transport_for_connection): More evil calls
to transport.get_transport defeating the wrapping.

* bzrlib/tests/test_selftest.py:
(test_get_readonly_url_none):
(TestTestCaseWithTransport.test_get_readonly_url_none):
(TestTestCaseWithTransport.test_get_readonly_url_http):
(TestChrootedTest.test_root_is_root): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_remote.py:
(Test_ClientMedium_remote_path_from_transport.assertRemotePath):
(Test_ClientMedium_remote_path_from_transport.assertRemotePathHTTP):
More evil calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/test_reconcile.py:
Unused import deleted.

* bzrlib/tests/test_permissions.py:
(check_mode_r):
(TestSftpPermissions.test_new_files):
(TestSftpPermissions.test_sftp_server_modes): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_lockable_files.py:
(setUp, TestLockableFiles_RemoteLockDir.setUp): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_knit.py:
(TestKnitIndex.test_knit_index_ignores_empty_files): More evil
calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/test_index.py:
(test_build_index_empty_two_element_keys):
(test_build_index_one_reference_list_empty):
(test_build_index_two_reference_list_empty):
(test_build_index_one_node_no_refs):
(test_build_index_one_node_no_refs_accepts_empty_reflist):
(TestGraphIndexBuilder.test_build_index_one_node_2_element_keys):
(test_add_node_empty_value):
(test_build_index_nodes_sorted):
(test_build_index_2_element_key_nodes_sorted):
(test_build_index_reference_lists_are_included_one):
(test_build_index_reference_lists_with_2_element_keys):
(test_build_index_reference_lists_are_included_two):
(test_clear_cache):
(test_node_references_are_cr_delimited):
(test_multiple_reference_lists_are_tab_delimited):
(test_add_node_referencing_missing_key_makes_absent):
(test_node_references_three_digits):
(test_absent_has_no_reference_overhead):
(test_add_node_bad_key):
(TestGraphIndexBuilder.test_add_node_bad_key):
(test_add_node_bad_key_in_reference_lists):
(TestGraphIndexBuilder.test_add_node_bad_key_in_reference_lists):
(make_index):
(test_open_bad_index_no_error):
(test_iter_missing_entry_empty_no_size):
(test_validate_bad_index_errors):
(test_supports_unlimited_cache):
(TestCombinedGraphIndex.make_combined_index_with_missing):
(reload):
(TestCombinedGraphIndex.test_clear_cache):
(test_reorder_after_iter_entries):
(test_validate_reloads):
(TestCombinedGraphIndex.test_find_ancestors_across_indexes):
(TestCombinedGraphIndex.test_find_ancestors_missing_keys):
(test_find_ancestors_no_indexes):
(TestCombinedGraphIndex.test_find_ancestors_ghost_parent):
(test__find_ancestors_empty_index):
(test_construct): More evil calls to transport.get_transport
defeating the wrapping and some more import fixes.

* bzrlib/tests/test_directory_service.py:
(TestDirectoryLookup.test_get_transport): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/test_debug.py:
Unused import deleted.

* bzrlib/tests/test_btree_index.py:
(TestBTreeBuilder.test_three_level_tree_details):
(TestBTreeBuilder.test_spill_index_stress_2_2):
(TestBTreeIndex.make_index):
(test_trivial_constructor):
(test__read_nodes_no_size_one_page_reads_once):
(TestBTreeIndex.test__read_nodes_no_size_multiple_pages):
(TestBTreeIndex.test_2_levels_key_count_2_2):
(TestBTreeIndex.test_validate_two_pages):
(TestBTreeIndex.test_iter_all_entries_reads):
(TestBTreeIndex.test_iter_all_entries_reads):
(TestBTreeIndex.test_iter_entries_references_2_refs_resolved):
(TestBTreeIndex.test_iter_entries_references_2_refs_resolved):
(TestBTreeIndex.test_supports_unlimited_cache):
(TestExpandOffsets.make_index): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/per_workingtree/test_pull.py:
Unused import deleted.

* bzrlib/tests/per_versionedfile.py:
(test_readonly_mode):
(TestWeave.get_file):
(reopen_file):
(TestReadonlyHttpMixin.test_readonly_http_works):
(TestReadonlyHttpMixin.test_readonly_http_works_with_feeling):
(TestWeaveHTTP.get_file):
(TestWeaveMerge.get_file): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/per_repository/test_reconcile.py:
(setUp):
(TestReconcileWithIncorrectRevisionCache.setUp):
(test_reconcile_wrong_order):
(test_reconcile_wrong_order_secondary_inventory): More evil calls
to transport.get_transport defeating the wrapping.

* bzrlib/tests/per_repository/test_has_same_location.py:
(TestHasSameLocation.test_different_format_not_equal): More evil
calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/per_repository/test_fetch.py:
Unused import deleted.

* bzrlib/tests/per_intertree/__init__.py:
Unused import deleted.

* bzrlib/tests/per_interrepository/__init__.py:
(TestCaseWithInterRepository.make_bzrdir): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/per_interbranch/test_push.py:
Unused import deleted.

* bzrlib/tests/per_interbranch/__init__.py:
Unused import deleted.

* bzrlib/tests/per_bzrdir/test_bzrdir.py:
(TestBzrDir.sproutOrSkip):
(TestBzrDir.test_format_initialize_find_open):
(TestBzrDir.test_open_not_bzrdir):
(TestBzrDir.test_open_branch):
(TestBzrDir.test_open_branch):
(TestBzrDir.test_list_branches):
(TestBzrDir.test_create_repository):
(TestBzrDir.test_create_repository_shared):
(TestBzrDir.test_create_repository_nonshared):
(TestBzrDir.test_open_repository):
(test_root_transport):
(TestBzrDir.test_find_repository_no_repo_under_standalone_branch):
(TestBzrDir.test_find_repository_containing_shared_repository):
(TestBzrDir.test_find_repository_shared_within_shared_repository):
(TestBzrDir.test_find_repository_with_nested_dirs_works):
(ChrootedBzrDirTests.test_find_repository_no_repository):
(TestBzrDirControlComponent): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/tests/per_branch/test_stacking.py: 
Unused import deleted.

* bzrlib/tests/per_branch/test_permissions.py: 
Unused import deleted.

* bzrlib/tests/per_branch/test_bound_sftp.py:
(test_unbinding): More evil calls to transport.get_transport
defeating the wrapping.

* bzrlib/tests/blackbox/test_upgrade.py:
(TestWithUpgradableBranches.test_upgrade_up_to_date_checkout_warns_branch_left_alone):
(test_upgrade_explicit_metaformat):
(TestWithUpgradableBranches.test_upgrade_explicit_knit):
(test_upgrade_with_existing_backup_dir):
(TestWithUpgradableBranches.test_upgrade_with_existing_backup_dir):
More evil calls to transport.get_transport defeating the wrapping.

* bzrlib/tests/blackbox/test_serve.py:
(test_bzr_serve_port_readonly): More evil calls to
transport.get_transport defeating the wrapping.

* bzrlib/plugins/launchpad/test_lp_directory.py:
(DirectoryOpenBranchTests.test_directory_open_branch): Use
transport.get_transport instead of get_transport.

* bzrlib/plugins/launchpad/account.py:
(check_lp_login): Use transport.get_transport instead of
get_transport.

* bzrlib/builtins.py (run): Use transport.get_transport instead of
get_transport.

* bzrlib/btree_index.py:
(BTreeBuilder._spill_mem_keys_to_disk): Use
transport.get_transport instead of get_transport.

* bzrlib/benchmarks/bench_commit.py:
Unused import deleted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                          )
56
56
from bzrlib.tests.per_bzrdir import TestCaseWithBzrDir
57
57
from bzrlib.trace import mutter
58
 
from bzrlib.transport import get_transport
59
58
from bzrlib.transport.local import LocalTransport
60
59
from bzrlib.ui import (
61
60
    CannedInputUIFactory,
202
201
        A simple wrapper for from_bzrdir.sprout that translates NotLocalUrl into
203
202
        TestSkipped.  Returns the newly sprouted bzrdir.
204
203
        """
205
 
        to_transport = get_transport(to_url)
 
204
        to_transport = transport.get_transport(to_url)
206
205
        if not isinstance(to_transport, LocalTransport):
207
206
            raise TestSkipped('Cannot sprout to remote bzrdirs.')
208
207
        target = from_bzrdir.sprout(to_url, revision_id=revision_id,
1183
1182
            '_network_name', None),
1184
1183
            None)
1185
1184
        # supported formats must be able to init and open
1186
 
        t = get_transport(self.get_url())
1187
 
        readonly_t = get_transport(self.get_readonly_url())
 
1185
        t = transport.get_transport(self.get_url())
 
1186
        readonly_t = transport.get_transport(self.get_readonly_url())
1188
1187
        made_control = self.bzrdir_format.initialize(t.base)
1189
1188
        self.failUnless(isinstance(made_control, bzrdir.BzrDir))
1190
1189
        self.assertEqual(self.bzrdir_format,
1394
1393
        # test the formats specific behaviour for no-content or similar dirs.
1395
1394
        self.assertRaises(NotBranchError,
1396
1395
                          self.bzrdir_format.open,
1397
 
                          get_transport(self.get_readonly_url()))
 
1396
                          transport.get_transport(self.get_readonly_url()))
1398
1397
 
1399
1398
    def test_create_branch(self):
1400
1399
        # a bzrdir can construct a branch and repository for itself.
1403
1402
            # because the default open will not open them and
1404
1403
            # they may not be initializable.
1405
1404
            return
1406
 
        t = get_transport(self.get_url())
 
1405
        t = transport.get_transport(self.get_url())
1407
1406
        made_control = self.bzrdir_format.initialize(t.base)
1408
1407
        made_repo = made_control.create_repository()
1409
1408
        made_branch = made_control.create_branch()
1416
1415
            # because the default open will not open them and
1417
1416
            # they may not be initializable.
1418
1417
            return
1419
 
        t = get_transport(self.get_url())
 
1418
        t = transport.get_transport(self.get_url())
1420
1419
        made_control = self.bzrdir_format.initialize(t.base)
1421
1420
        made_repo = made_control.create_repository()
1422
1421
        made_branch = made_control.create_branch()
1431
1430
            # because the default open will not open them and
1432
1431
            # they may not be initializable.
1433
1432
            return
1434
 
        t = get_transport(self.get_url())
 
1433
        t = transport.get_transport(self.get_url())
1435
1434
        made_control = self.bzrdir_format.initialize(t.base)
1436
1435
        made_repo = made_control.create_repository()
1437
1436
        made_branch = made_control.create_branch()
1452
1451
            # because the default open will not open them and
1453
1452
            # they may not be initializable.
1454
1453
            return
1455
 
        t = get_transport(self.get_url())
 
1454
        t = transport.get_transport(self.get_url())
1456
1455
        made_control = self.bzrdir_format.initialize(t.base)
1457
1456
        made_repo = made_control.create_repository()
1458
1457
        # Check that we have a repository object.
1467
1466
            # because the default open will not open them and
1468
1467
            # they may not be initializable.
1469
1468
            return
1470
 
        t = get_transport(self.get_url())
 
1469
        t = transport.get_transport(self.get_url())
1471
1470
        made_control = self.bzrdir_format.initialize(t.base)
1472
1471
        try:
1473
1472
            made_repo = made_control.create_repository(shared=True)
1484
1483
            # because the default open will not open them and
1485
1484
            # they may not be initializable.
1486
1485
            return
1487
 
        t = get_transport(self.get_url())
 
1486
        t = transport.get_transport(self.get_url())
1488
1487
        made_control = self.bzrdir_format.initialize(t.base)
1489
1488
        made_repo = made_control.create_repository(shared=False)
1490
1489
        self.assertFalse(made_repo.is_shared())
1495
1494
            # because the default open will not open them and
1496
1495
            # they may not be initializable.
1497
1496
            return
1498
 
        t = get_transport(self.get_url())
 
1497
        t = transport.get_transport(self.get_url())
1499
1498
        made_control = self.bzrdir_format.initialize(t.base)
1500
1499
        made_repo = made_control.create_repository()
1501
1500
        opened_repo = made_control.open_repository()
1623
1622
    def test_root_transport(self):
1624
1623
        dir = self.make_bzrdir('.')
1625
1624
        self.assertEqual(dir.root_transport.base,
1626
 
                         get_transport(self.get_url('.')).base)
 
1625
                         transport.get_transport(self.get_url('.')).base)
1627
1626
 
1628
1627
    def test_find_repository_no_repo_under_standalone_branch(self):
1629
1628
        # finding a repo stops at standalone branches even if there is a
1634
1633
            # need a shared repository to test this.
1635
1634
            return
1636
1635
        url = self.get_url('intermediate')
1637
 
        get_transport(self.get_url()).mkdir('intermediate')
1638
 
        get_transport(self.get_url()).mkdir('intermediate/child')
 
1636
        transport.get_transport(self.get_url()).mkdir('intermediate')
 
1637
        transport.get_transport(self.get_url()).mkdir('intermediate/child')
1639
1638
        made_control = self.bzrdir_format.initialize(url)
1640
1639
        made_control.create_repository()
1641
1640
        innermost_control = self.bzrdir_format.initialize(
1659
1658
            # need a shared repository to test this.
1660
1659
            return
1661
1660
        url = self.get_url('childbzrdir')
1662
 
        get_transport(self.get_url()).mkdir('childbzrdir')
 
1661
        transport.get_transport(self.get_url()).mkdir('childbzrdir')
1663
1662
        made_control = self.bzrdir_format.initialize(url)
1664
1663
        try:
1665
1664
            child_repo = made_control.open_repository()
1693
1692
            # need a shared repository to test this.
1694
1693
            return
1695
1694
        url = self.get_url('childrepo')
1696
 
        get_transport(self.get_url()).mkdir('childrepo')
 
1695
        transport.get_transport(self.get_url()).mkdir('childrepo')
1697
1696
        child_control = self.bzrdir_format.initialize(url)
1698
1697
        child_repo = child_control.create_repository(shared=True)
1699
1698
        opened_control = bzrdir.BzrDir.open(self.get_url('childrepo'))
1712
1711
            # need a shared repository to test this.
1713
1712
            return
1714
1713
        url = self.get_url('intermediate')
1715
 
        get_transport(self.get_url()).mkdir('intermediate')
1716
 
        get_transport(self.get_url()).mkdir('intermediate/child')
 
1714
        transport.get_transport(self.get_url()).mkdir('intermediate')
 
1715
        transport.get_transport(self.get_url()).mkdir('intermediate/child')
1717
1716
        made_control = self.bzrdir_format.initialize(url)
1718
1717
        try:
1719
1718
            child_repo = made_control.open_repository()
1958
1957
        # - do the vfs initialisation over the basic vfs transport
1959
1958
        # XXX: TODO this should become a 'bzrdirlocation' api call.
1960
1959
        url = self.get_vfs_only_url('subdir')
1961
 
        get_transport(self.get_vfs_only_url()).mkdir('subdir')
 
1960
        transport.get_transport(self.get_vfs_only_url()).mkdir('subdir')
1962
1961
        made_control = self.bzrdir_format.initialize(self.get_url('subdir'))
1963
1962
        try:
1964
1963
            repo = made_control.open_repository()
1974
1973
 
1975
1974
class TestBzrDirControlComponent(TestCaseWithBzrDir):
1976
1975
    """BzrDir implementations adequately implement ControlComponent."""
1977
 
    
 
1976
 
1978
1977
    def test_urls(self):
1979
1978
        bd = self.make_bzrdir('bd')
1980
1979
        self.assertIsInstance(bd.user_url, str)