Rev 4667: Switch away from creating a whole repository just to get a VF. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.1-faster-chk-tests

John Arbash Meinel john at arbash-meinel.com
Wed Sep 23 21:49:03 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.1-faster-chk-tests

------------------------------------------------------------
revno: 4667
revision-id: john at arbash-meinel.com-20090923204852-0023jhs8es8dfqk7
parent: pqm at pqm.ubuntu.com-20090917173934-bx8l6ujeitu9qfkg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.1-faster-chk-tests
timestamp: Wed 2009-09-23 15:48:52 -0500
message:
  Switch away from creating a whole repository just to get a VF.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py	2009-09-09 01:28:34 +0000
+++ b/bzrlib/tests/test_inv.py	2009-09-23 20:48:52 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,12 +17,14 @@
 
 from bzrlib import (
     chk_map,
+    groupcompress,
     bzrdir,
     errors,
     inventory,
     osutils,
     repository,
     revision,
+    tests,
     )
 from bzrlib.inventory import (CHKInventory, Inventory, ROOT_ID, InventoryFile,
     InventoryDirectory, InventoryEntry, TreeReference)
@@ -650,17 +652,12 @@
         self.assertEqual(expected_change, change)
 
 
-class TestCHKInventory(TestCaseWithTransport):
+class TestCHKInventory(tests.TestCaseWithMemoryTransport):
 
     def get_chk_bytes(self):
-        # The easiest way to get a CHK store is a development6 repository and
-        # then work with the chk_bytes attribute directly.
-        repo = self.make_repository(".", format="development6-rich-root")
-        repo.lock_write()
-        self.addCleanup(repo.unlock)
-        repo.start_write_group()
-        self.addCleanup(repo.abort_write_group)
-        return repo.chk_bytes
+        factory = groupcompress.make_pack_factory(True, True, 1)
+        trans = self.get_transport('')
+        return factory(trans)
 
     def read_bytes(self, chk_bytes, key):
         stream = chk_bytes.get_record_stream([key], 'unordered', True)



More information about the bazaar-commits mailing list