Rev 4669: (jam) Minor test suite speedup. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 3 16:05:09 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4669 [merge]
revision-id: pqm at pqm.ubuntu.com-20090903150454-mm3xdxw6jq6mml5l
parent: pqm at pqm.ubuntu.com-20090903012533-qc6kvh5ujgk8042p
parent: john at arbash-meinel.com-20090903045146-b2iiajr1uu77amve
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-09-03 16:04:54 +0100
message:
  (jam) Minor test suite speedup.
modified:
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2009-08-17 23:15:55 +0000
+++ b/bzrlib/tests/test_repository.py	2009-09-03 04:51:46 +0000
@@ -681,15 +681,18 @@
         self.assertFalse(repo._format.supports_external_lookups)
 
 
-class Test2a(TestCaseWithTransport):
+class Test2a(tests.TestCaseWithMemoryTransport):
 
     def test_format_pack_compresses_True(self):
         repo = self.make_repository('repo', format='2a')
         self.assertTrue(repo._format.pack_compresses)
 
     def test_inventories_use_chk_map_with_parent_base_dict(self):
-        tree = self.make_branch_and_tree('repo', format="2a")
+        tree = self.make_branch_and_memory_tree('repo', format="2a")
+        tree.lock_write()
+        tree.add([''], ['TREE_ROOT'])
         revid = tree.commit("foo")
+        tree.unlock()
         tree.lock_read()
         self.addCleanup(tree.unlock)
         inv = tree.branch.repository.get_inventory(revid)
@@ -704,12 +707,19 @@
         # at 20 unchanged commits, chk pages are packed that are split into
         # two groups such that the new pack being made doesn't have all its
         # pages in the source packs (though they are in the repository).
-        tree = self.make_branch_and_tree('tree', format='2a')
+        # Use a memory backed repository, we don't need to hit disk for this
+        tree = self.make_branch_and_memory_tree('tree', format='2a')
+        tree.lock_write()
+        self.addCleanup(tree.unlock)
+        tree.add([''], ['TREE_ROOT'])
         for pos in range(20):
             tree.commit(str(pos))
 
     def test_pack_with_hint(self):
-        tree = self.make_branch_and_tree('tree', format='2a')
+        tree = self.make_branch_and_memory_tree('tree', format='2a')
+        tree.lock_write()
+        self.addCleanup(tree.unlock)
+        tree.add([''], ['TREE_ROOT'])
         # 1 commit to leave untouched
         tree.commit('1')
         to_keep = tree.branch.repository._pack_collection.names()




More information about the bazaar-commits mailing list