Rev 4151: More test fallout, but all caught now. in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Mon Mar 16 07:44:11 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4151
revision-id: robertc at robertcollins.net-20090316074405-t9guvf13rj4mlhuk
parent: robertc at robertcollins.net-20090316055532-n2i9etfgbf8sd13y
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Mon 2009-03-16 18:44:05 +1100
message:
  More test fallout, but all caught now.
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2009-02-25 21:13:22 +0000
+++ b/bzrlib/tests/test_knit.py	2009-03-16 07:44:05 +0000
@@ -368,25 +368,23 @@
         """
         tree = self.make_branch_and_memory_tree('tree')
         tree.lock_write()
-        try:
-            tree.add([''], ['root-id'])
-            tree.commit('one', rev_id='rev-1')
-            tree.commit('two', rev_id='rev-2')
-            tree.commit('three', rev_id='rev-3')
-            # Pack these two revisions into another pack file, but don't remove
-            # the originials
-            repo = tree.branch.repository
-            collection = repo._pack_collection
-            collection.ensure_loaded()
-            orig_packs = collection.packs
-            packer = pack_repo.Packer(collection, orig_packs, '.testpack')
-            new_pack = packer.pack()
-
-            vf = tree.branch.repository.revisions
-        finally:
-            tree.unlock()
-        tree.branch.repository.lock_read()
         self.addCleanup(tree.branch.repository.unlock)
+        tree.add([''], ['root-id'])
+        tree.commit('one', rev_id='rev-1')
+        tree.commit('two', rev_id='rev-2')
+        tree.commit('three', rev_id='rev-3')
+        # Pack these three revisions into another pack file, but don't remove
+        # the originals
+        repo = tree.branch.repository
+        collection = repo._pack_collection
+        collection.ensure_loaded()
+        orig_packs = collection.packs
+        packer = pack_repo.Packer(collection, orig_packs, '.testpack')
+        new_pack = packer.pack()
+        # forget about the new pack
+        collection.reset()
+        repo.refresh_data()
+        vf = tree.branch.repository.revisions
         del tree
         # Set up a reload() function that switches to using the new pack file
         new_index = new_pack.revision_index

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2009-03-13 02:13:08 +0000
+++ b/bzrlib/tests/test_remote.py	2009-03-16 07:44:05 +0000
@@ -1882,8 +1882,15 @@
 class _StubRealPackRepository(object):
 
     def __init__(self, calls):
+        self.calls = calls
         self._pack_collection = _StubPackCollection(calls)
 
+    def is_in_write_group(self):
+        return False
+
+    def refresh_data(self):
+        self.calls.append(('pack collection reload_pack_names',))
+
 
 class _StubPackCollection(object):
 
@@ -1893,9 +1900,6 @@
     def autopack(self):
         self.calls.append(('pack collection autopack',))
 
-    def reload_pack_names(self):
-        self.calls.append(('pack collection reload_pack_names',))
-
 
 class TestRemotePackRepositoryAutoPack(TestRemoteRepository):
     """Tests for RemoteRepository.autopack implementation."""

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2009-03-13 05:40:03 +0000
+++ b/bzrlib/tests/test_repository.py	2009-03-16 07:44:05 +0000
@@ -929,6 +929,7 @@
         tree.lock_read()
         self.addCleanup(tree.unlock)
         packs = tree.branch.repository._pack_collection
+        packs.reset()
         packs.ensure_loaded()
         name = packs.names()[0]
         pack_1 = packs.get_pack_by_name(name)

=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py	2009-03-09 08:45:56 +0000
+++ b/bzrlib/tests/test_smart.py	2009-03-16 07:44:05 +0000
@@ -1237,6 +1237,8 @@
 
     def test_autopack_needed(self):
         repo = self.make_repo_needing_autopacking()
+        repo.lock_write()
+        self.addCleanup(repo.unlock)
         backing = self.get_transport()
         request = smart.packrepository.SmartServerPackRepositoryAutopack(
             backing)
@@ -1248,6 +1250,8 @@
     def test_autopack_not_needed(self):
         tree = self.make_branch_and_tree('.', format='pack-0.92')
         repo = tree.branch.repository
+        repo.lock_write()
+        self.addCleanup(repo.unlock)
         for x in range(9):
             tree.commit('commit %s' % x)
         backing = self.get_transport()




More information about the bazaar-commits mailing list