Merge lp:~jameinel/bzr/2.0.1-faster-chk-tests into lp:bzr/2.0

Proposed by John A Meinel
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jameinel/bzr/2.0.1-faster-chk-tests
Merge into: lp:bzr/2.0
Diff against target: None lines
To merge this branch: bzr merge lp:~jameinel/bzr/2.0.1-faster-chk-tests
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+12311@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This is a fairly trivial test suite cleanup.

I'm looking at working on bug 374730 as a potential 2.0 target, but wanted to clean this up along the way (thus this must also be a 2.0 target.)

Anyway, this change changes a test case to work entirely in memory. We've already changed test_chk_map to do the same, we just missed this one.

With this change "time bzr selftest -s bt.test_inv.TestCHK"
drops from 1.06s down to 0.343s And 156ms of that is the TestCase creation of the testing directory overhead.

So the real benefit is 904ms => 187ms or almost 5x faster.

Revision history for this message
Robert Collins (lifeless) wrote :

On Wed, 2009-09-23 at 20:55 +0000, John A Meinel wrote:

> drops from 1.06s down to 0.343s And 156ms of that is the TestCase creation of the testing directory overhead.

Yeah, I have my eye on that directory, it will take some time and care
to get to.

 review +1
 merge approved
 control-message input
 wheel spun
 etc

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/test_inv.py'
2--- bzrlib/tests/test_inv.py 2009-09-09 01:28:34 +0000
3+++ bzrlib/tests/test_inv.py 2009-09-23 20:48:52 +0000
4@@ -1,4 +1,4 @@
5-# Copyright (C) 2005, 2006, 2007 Canonical Ltd
6+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10@@ -17,12 +17,14 @@
11
12 from bzrlib import (
13 chk_map,
14+ groupcompress,
15 bzrdir,
16 errors,
17 inventory,
18 osutils,
19 repository,
20 revision,
21+ tests,
22 )
23 from bzrlib.inventory import (CHKInventory, Inventory, ROOT_ID, InventoryFile,
24 InventoryDirectory, InventoryEntry, TreeReference)
25@@ -650,17 +652,12 @@
26 self.assertEqual(expected_change, change)
27
28
29-class TestCHKInventory(TestCaseWithTransport):
30+class TestCHKInventory(tests.TestCaseWithMemoryTransport):
31
32 def get_chk_bytes(self):
33- # The easiest way to get a CHK store is a development6 repository and
34- # then work with the chk_bytes attribute directly.
35- repo = self.make_repository(".", format="development6-rich-root")
36- repo.lock_write()
37- self.addCleanup(repo.unlock)
38- repo.start_write_group()
39- self.addCleanup(repo.abort_write_group)
40- return repo.chk_bytes
41+ factory = groupcompress.make_pack_factory(True, True, 1)
42+ trans = self.get_transport('')
43+ return factory(trans)
44
45 def read_bytes(self, chk_bytes, key):
46 stream = chk_bytes.get_record_stream([key], 'unordered', True)

Subscribers

People subscribed via source and target branches