Rev 4652: Remove unnecessary use of an SFTP server connection to test the behaviour of TestCase.make_branch_and_tree. in http://bazaar.launchpad.net/~lifeless/bzr/test-speed
Robert Collins
robertc at robertcollins.net
Wed Aug 26 07:21:13 BST 2009
At http://bazaar.launchpad.net/~lifeless/bzr/test-speed
------------------------------------------------------------
revno: 4652
revision-id: robertc at robertcollins.net-20090826062110-w04qauzwcad5fscv
parent: robertc at robertcollins.net-20090826062005-e4yucsjkaepn157o
committer: Robert Collins <robertc at robertcollins.net>
branch nick: test-speed
timestamp: Wed 2009-08-26 16:21:10 +1000
message:
Remove unnecessary use of an SFTP server connection to test the behaviour of TestCase.make_branch_and_tree.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-08-26 06:20:05 +0000
+++ b/bzrlib/tests/__init__.py 2009-08-26 06:21:10 +0000
@@ -2498,6 +2498,15 @@
repository will also be accessed locally. Otherwise a lightweight
checkout is created and returned.
+ We do this because we can't physically create a tree in the local
+ path, with a branch reference to the transport_factory url, and
+ a branch + repository in the vfs_transport, unless the vfs_transport
+ namespace is distinct from the local disk - the two branch objects
+ would collide. While we could construct a tree with its branch object
+ pointing at the transport_factory transport in memory, reopening it
+ would behaving unexpectedly, and has in the past caused testing bugs
+ when we tried to do it that way.
+
:param format: The BzrDirFormat.
:returns: the WorkingTree.
"""
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2009-08-26 06:20:05 +0000
+++ b/bzrlib/tests/test_selftest.py 2009-08-26 06:21:10 +0000
@@ -1773,16 +1773,16 @@
tree = self.make_branch_and_memory_tree('a')
self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree)
-
-class TestSFTPMakeBranchAndTree(test_sftp_transport.TestCaseWithSFTPServer):
-
- def test_make_tree_for_sftp_branch(self):
- """Transports backed by local directories create local trees."""
- # NB: This is arguably a bug in the definition of make_branch_and_tree.
+ def test_make_tree_for_local_vfs_backed_transport(self):
+ # make_branch_and_tree has to use local branch and repositories
+ # when the vfs transport and local disk are colocated, even if
+ # a different transport is in use for url generation.
+ from bzrlib.transport.fakevfat import FakeVFATServer
+ self.transport_server = FakeVFATServer
+ self.assertFalse(self.get_url('t1').startswith('file://'))
tree = self.make_branch_and_tree('t1')
base = tree.bzrdir.root_transport.base
- self.failIf(base.startswith('sftp'),
- 'base %r is on sftp but should be local' % base)
+ self.assertStartsWith(base, 'file://')
self.assertEquals(tree.bzrdir.root_transport,
tree.branch.bzrdir.root_transport)
self.assertEquals(tree.bzrdir.root_transport,
More information about the bazaar-commits
mailing list