Rev 4668: Drop the Test2a test times from 5+s down to 1.4s in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Wed Sep 2 22:16:59 BST 2009


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 4668
revision-id: john at arbash-meinel.com-20090902211644-1929sdkr1y4eyxl8
parent: pqm at pqm.ubuntu.com-20090902180758-uuuxc8dd62vq67i8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2009-09-02 16:16:44 -0500
message:
  Drop the Test2a test times from 5+s down to 1.4s
  
  Mostly just switching to use Memory backed repositories, rather than
  on-disk. That way we don't have to take out NTFS filesystem directory locks.
-------------- next part --------------
=== 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-02 21:16:44 +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,20 @@
         # 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
+        self.vfs_transport_factory = MemoryServer
+        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