Rev 2182: Merge incremental cleanups from hpss-test-correctness. in http://bazaar.launchpad.net/~bzr/bzr/hpss

Robert Collins robertc at robertcollins.net
Wed Mar 28 14:46:59 BST 2007


At http://bazaar.launchpad.net/~bzr/bzr/hpss

------------------------------------------------------------
revno: 2182
revision-id: robertc at robertcollins.net-20070328134526-y54ua41jbtoxbgcf
parent: robertc at robertcollins.net-20070328084906-3n8damdsktuvt5ob
parent: robertc at robertcollins.net-20070328133358-wn7wgnzmb0cjohjk
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss
timestamp: Wed 2007-03-28 23:45:26 +1000
message:
  Merge incremental cleanups from hpss-test-correctness.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/HttpServer.py     httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
  bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 2018.1.2.1.50.2.80.1.99.1.9.1.21.1.26.2.74.2.4
    merged: robertc at robertcollins.net-20070328133358-wn7wgnzmb0cjohjk
    parent: robertc at robertcollins.net-20070328073307-ni7dcww9b1rf0udp
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: hpss-test-correctness
    timestamp: Wed 2007-03-28 23:33:58 +1000
    message:
      Fixup the test changes made for hpss to be clean and self contained.
=== modified file 'NEWS'
--- a/NEWS	2007-03-28 05:28:28 +0000
+++ b/NEWS	2007-03-28 13:45:26 +0000
@@ -21,6 +21,30 @@
       return a StraceResult object which contains just the syscalls involved
       in running it. (Robert Collins)
 
+    * New test method ``reduceLockdirTimeout`` to drop the default (ui-centric)
+      default time down to one suitable for tests. (Andrew Bennetts)
+
+    * Add new vfs_transport_factory attribute on tests which provides the 
+      common vfs backing for both the readonly and readwrite transports.
+      This allows the RemoteObject tests to back onto local disk or memory,
+      and use the existing transport_server attribute all tests know about
+      to be the smart server transport. This in turn allows tests to 
+      differentiate between 'transport to access the branch', and 
+      'transport which is a VFS' - which matters in Remote* tests.
+      (Robert Collins, Andrew Bennetts)
+
+    * The ``make_branch_and_tree`` method for tests will now create a 
+      lightweight checkout for the tree if the vfs_transport_factory is not
+      a LocalURLServer. (Robert Collins, Andrew Bennetts)
+
+    * Branch implementation tests have been audited to ensure that all urls 
+      passed to Branch APIs use proper urls, except when local-disk paths
+      are intended. This is so that tests correctly access the test transport
+      which is often not equivalent to local disk in Remote* tests. As part
+      of this many tests were adjusted to remove dependencies on local disk
+      access.
+      (Robert Collins, Andrew Bennetts)
+
 
 bzr 0.15 (not finalised)
 

=== modified file 'bzrlib/tests/HttpServer.py'
--- a/bzrlib/tests/HttpServer.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/HttpServer.py	2007-03-28 13:45:26 +0000
@@ -29,6 +29,7 @@
 import urlparse
 
 from bzrlib.transport import Server
+from bzrlib.transport.local import LocalURLServer
 
 
 class WebserverNotAvailable(Exception):
@@ -304,13 +305,19 @@
         """Capture Server log output."""
         self.logs.append(format % args)
 
-    def setUp(self, decorated_transport=None):
+    def setUp(self, backing_transport_server=None):
         """See bzrlib.transport.Server.setUp.
         
-        :param decorated_transport: The transport that requests over this
+        :param backing_transport_server: The transport that requests over this
             protocol should be forwarded to. Note that this is currently not
-            supported for HTTP - it is ignored.
+            supported for HTTP.
         """
+        # XXX: TODO: make the server back onto vfs_server rather than local
+        # disk.
+        assert backing_transport_server is None or \
+            isinstance(backing_transport_server, LocalURLServer), \
+            "HTTPServer currently assumes local transport, got %s" % \
+            backing_transport_server
         self._home_dir = os.getcwdu()
         self._local_path_parts = self._home_dir.split(os.path.sep)
         self._http_starting = threading.Lock()

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/__init__.py	2007-03-28 13:45:26 +0000
@@ -1908,12 +1908,11 @@
         """Create a branch on the transport and a tree locally.
 
         If the transport is not a LocalTransport, the Tree can't be created on
-        the transport.  In that case the working tree is created in the local
+        the transport.  In that case if the vfs_transport_factory is
+        LocalURLServer the working tree is created in the local
         directory backing the transport, and the returned tree's branch and
-        repository will also be accessed locally.
-
-        If the original default transport for this test case isn't backed by the
-        working directory, this will return a checkout.
+        repository will also be accessed locally. Otherwise a lightweight
+        checkout is created and returned.
 
         :param format: The BzrDirFormat.
         :returns: the WorkingTree.

=== modified file 'bzrlib/tests/branch_implementations/__init__.py'
--- a/bzrlib/tests/branch_implementations/__init__.py	2007-03-28 08:49:06 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py	2007-03-28 13:45:26 +0000
@@ -60,8 +60,6 @@
     # use.
     combinations = [(format, format._matchingbzrdir) for format in 
          BranchFormat._formats.values() + _legacy_formats]
-    # TODO: To usefully test the SmartServer, we need to specify the bzrdir
-    # format, branch format, and also the transport.
     adapter = BranchTestProviderAdapter(
         # None here will cause the default vfs transport server to be used.
         None,

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-03-28 13:45:26 +0000
@@ -661,8 +661,6 @@
             self.branch_format.get_format_string()
         except NotImplementedError:
             return
-        if self.branch_format.get_format_string() == 'Remote BZR Branch':
-            return
         self.assertEqual(self.branch_format,
                          branch.BranchFormat.find_format(opened_control))
 

=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-03-28 13:45:26 +0000
@@ -1050,7 +1050,6 @@
         made_repo = made_control.create_repository()
         # Check that we have a repository object.
         made_repo.has_revision('foo')
-
         self.assertEqual(made_control, made_repo.bzrdir)
 
     def test_create_repository_shared(self):

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-03-28 13:45:26 +0000
@@ -119,7 +119,6 @@
         readonly_t = get_transport(self.get_readonly_url())
         made_control = self.bzrdir_format.initialize(t.base)
         made_repo = self.repository_format.initialize(made_control)
-        ## self.failUnless(isinstance(made_repo, repository.Repository))
         self.assertEqual(made_control, made_repo.bzrdir)
 
         # find it via bzrdir opening:
@@ -155,7 +154,6 @@
         made_repo = made_control.create_repository()
         # Check that we have a repository object.
         made_repo.has_revision('foo')
-        
         self.assertEqual(made_control, made_repo.bzrdir)
         
     def test_create_repository_shared(self):
@@ -175,7 +173,6 @@
             return
         # Check that we have a repository object.
         made_repo.has_revision('foo')
-
         self.assertEqual(made_control, made_repo.bzrdir)
         self.assertTrue(made_repo.is_shared())
 
@@ -463,13 +460,7 @@
 
     def setUp(self):
         TestCaseWithRepository.setUp(self)
-        # XXX: This lock timeout fiddling occurs in other tests (e.g.
-        # test_lockable_files) too.
-        orig_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
-        def resetTimeout():
-            lockdir._DEFAULT_TIMEOUT_SECONDS = orig_timeout
-        self.addCleanup(resetTimeout)
-        lockdir._DEFAULT_TIMEOUT_SECONDS = 0
+        self.reduceLockdirTimeout()
 
     def test_leave_lock_in_place(self):
         repo = self.make_repository('r')



More information about the bazaar-commits mailing list