~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_versionedfile.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:
31
31
    knit as _mod_knit,
32
32
    osutils,
33
33
    progress,
 
34
    transport,
34
35
    ui,
35
36
    )
36
37
from bzrlib.errors import (
56
57
    )
57
58
from bzrlib.tests.http_utils import TestCaseWithWebserver
58
59
from bzrlib.trace import mutter
59
 
from bzrlib.transport import get_transport
60
60
from bzrlib.transport.memory import MemoryTransport
61
61
from bzrlib.tsort import topo_sort
62
62
from bzrlib.tuned_gzip import GzipFile
849
849
        self.assertEquals(('references_ghost', 'line_c\n'), origins[2])
850
850
 
851
851
    def test_readonly_mode(self):
852
 
        transport = get_transport(self.get_url('.'))
 
852
        t = transport.get_transport(self.get_url('.'))
853
853
        factory = self.get_factory()
854
 
        vf = factory('id', transport, 0777, create=True, access_mode='w')
855
 
        vf = factory('id', transport, access_mode='r')
 
854
        vf = factory('id', t, 0777, create=True, access_mode='w')
 
855
        vf = factory('id', t, access_mode='r')
856
856
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'base', [], [])
857
857
        self.assertRaises(errors.ReadOnlyError,
858
858
                          vf.add_lines_with_ghosts,
880
880
class TestWeave(TestCaseWithMemoryTransport, VersionedFileTestMixIn):
881
881
 
882
882
    def get_file(self, name='foo'):
883
 
        return WeaveFile(name, get_transport(self.get_url('.')), create=True,
884
 
            get_scope=self.get_transaction)
 
883
        return WeaveFile(name, transport.get_transport(self.get_url('.')),
 
884
                         create=True,
 
885
                         get_scope=self.get_transaction)
885
886
 
886
887
    def get_file_corrupted_text(self):
887
 
        w = WeaveFile('foo', get_transport(self.get_url('.')), create=True,
888
 
            get_scope=self.get_transaction)
 
888
        w = WeaveFile('foo', transport.get_transport(self.get_url('.')),
 
889
                      create=True,
 
890
                      get_scope=self.get_transaction)
889
891
        w.add_lines('v1', [], ['hello\n'])
890
892
        w.add_lines('v2', ['v1'], ['hello\n', 'there\n'])
891
893
 
919
921
        return w
920
922
 
921
923
    def reopen_file(self, name='foo', create=False):
922
 
        return WeaveFile(name, get_transport(self.get_url('.')), create=create,
923
 
            get_scope=self.get_transaction)
 
924
        return WeaveFile(name, transport.get_transport(self.get_url('.')),
 
925
                         create=create,
 
926
                         get_scope=self.get_transaction)
924
927
 
925
928
    def test_no_implicit_create(self):
926
929
        self.assertRaises(errors.NoSuchFile,
927
930
                          WeaveFile,
928
931
                          'foo',
929
 
                          get_transport(self.get_url('.')),
 
932
                          transport.get_transport(self.get_url('.')),
930
933
                          get_scope=self.get_transaction)
931
934
 
932
935
    def get_factory(self):
999
1002
        # we should be able to read from http with a versioned file.
1000
1003
        vf = self.get_file()
1001
1004
        # try an empty file access
1002
 
        readonly_vf = self.get_factory()('foo', get_transport(
 
1005
        readonly_vf = self.get_factory()('foo', transport.get_transport(
1003
1006
                self.get_readonly_url('.')))
1004
1007
        self.assertEqual([], readonly_vf.versions())
1005
1008
 
1009
1012
        # now with feeling.
1010
1013
        vf.add_lines('1', [], ['a\n'])
1011
1014
        vf.add_lines('2', ['1'], ['b\n', 'a\n'])
1012
 
        readonly_vf = self.get_factory()('foo', get_transport(
 
1015
        readonly_vf = self.get_factory()('foo', transport.get_transport(
1013
1016
                self.get_readonly_url('.')))
1014
1017
        self.assertEqual(['1', '2'], vf.versions())
1015
1018
        self.assertEqual(['1', '2'], readonly_vf.versions())
1020
1023
class TestWeaveHTTP(TestCaseWithWebserver, TestReadonlyHttpMixin):
1021
1024
 
1022
1025
    def get_file(self):
1023
 
        return WeaveFile('foo', get_transport(self.get_url('.')), create=True,
1024
 
            get_scope=self.get_transaction)
 
1026
        return WeaveFile('foo', transport.get_transport(self.get_url('.')),
 
1027
                         create=True,
 
1028
                         get_scope=self.get_transaction)
1025
1029
 
1026
1030
    def get_factory(self):
1027
1031
        return WeaveFile
1271
1275
class TestWeaveMerge(TestCaseWithMemoryTransport, MergeCasesMixin):
1272
1276
 
1273
1277
    def get_file(self, name='foo'):
1274
 
        return WeaveFile(name, get_transport(self.get_url('.')), create=True)
 
1278
        return WeaveFile(name, transport.get_transport(self.get_url('.')),
 
1279
                         create=True)
1275
1280
 
1276
1281
    def log_contents(self, w):
1277
1282
        self.log('weave is:')