Rev 2383: Fixup the test changes made for hpss to be clean and self contained. in file:///home/robertc/source/baz/hpss-test-correctness/

Robert Collins robertc at robertcollins.net
Wed Mar 28 14:34:01 BST 2007


At file:///home/robertc/source/baz/hpss-test-correctness/

------------------------------------------------------------
revno: 2383
revision-id: 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:
  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/lock_helpers.py   LockHelpers.py-20060707151933-tav3o2hpibwi53u4-1
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'NEWS'
--- a/NEWS	2007-03-28 05:19:01 +0000
+++ b/NEWS	2007-03-28 13:33:58 +0000
@@ -17,6 +17,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:33:07 +0000
+++ b/bzrlib/tests/HttpServer.py	2007-03-28 13:33:58 +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:33:07 +0000
+++ b/bzrlib/tests/__init__.py	2007-03-28 13:33:58 +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 07:33:07 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py	2007-03-28 13:33:58 +0000
@@ -61,8 +61,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(
         default_transport,
         # None here will cause a readonly decorator to be created

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-03-28 07:33:07 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-03-28 13:33:58 +0000
@@ -650,8 +650,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:33:07 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-03-28 13:33:58 +0000
@@ -1024,7 +1024,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/lock_helpers.py'
--- a/bzrlib/tests/lock_helpers.py	2007-03-28 07:33:07 +0000
+++ b/bzrlib/tests/lock_helpers.py	2007-03-28 13:33:58 +0000
@@ -56,7 +56,7 @@
             return self._other.lock_read()
         raise TestPreventLocking('lock_read disabled')
 
-    def lock_write(self, token=None):
+    def lock_write(self):
         self._sequence.append((self._other_id, 'lw', self._allow_write))
         if self._allow_write:
             return self._other.lock_write()

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-03-28 07:33:07 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-03-28 13:33:58 +0000
@@ -107,7 +107,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:
@@ -143,7 +142,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):
@@ -163,7 +161,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())
 
@@ -447,16 +444,6 @@
 
 class TestRepositoryLocking(TestCaseWithRepository):
 
-    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
-
     def test_lock_read_then_unlock(self):
         # Calling lock_read then unlocking should work without errors.
         repo = self.make_repository('r')



More information about the bazaar-commits mailing list