Rev 3170: Reduce selftest overhead to establish test names by memoization in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Jan 7 17:49:52 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3170
revision-id:pqm at pqm.ubuntu.com-20080107174938-hvwo399dzshh3cod
parent: pqm at pqm.ubuntu.com-20080105015401-67wgbytv81394cl1
parent: v.ladeuil+lp at free.fr-20080107164746-bome6yaxlwqbc7kh
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-01-07 17:49:38 +0000
message:
Reduce selftest overhead to establish test names by memoization
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/TestUtil.py TestUtil.py-20050824080200-5f70140a2d938694
------------------------------------------------------------
revno: 3169.1.1
revision-id:v.ladeuil+lp at free.fr-20080107164746-bome6yaxlwqbc7kh
parent: pqm at pqm.ubuntu.com-20080105015401-67wgbytv81394cl1
parent: v.ladeuil+lp at free.fr-20080107164531-6qm2hwnnkoipth60
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Mon 2008-01-07 17:47:46 +0100
message:
Reduce selftest overhead to establish test names by memoization
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/TestUtil.py TestUtil.py-20050824080200-5f70140a2d938694
------------------------------------------------------------
revno: 3146.7.2
revision-id:v.ladeuil+lp at free.fr-20080107164531-6qm2hwnnkoipth60
parent: v.ladeuil+lp at free.fr-20071229120125-1vf2l1w7x8y3pw9i
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: selftest
timestamp: Mon 2008-01-07 17:45:31 +0100
message:
Review feedback. Fix variable names and scope.
modified:
bzrlib/tests/TestUtil.py TestUtil.py-20050824080200-5f70140a2d938694
------------------------------------------------------------
revno: 3146.7.1
revision-id:v.ladeuil+lp at free.fr-20071229120125-1vf2l1w7x8y3pw9i
parent: pqm at pqm.ubuntu.com-20071228175832-9kboqtkemnuzzlab
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: selftest
timestamp: Sat 2007-12-29 13:01:25 +0100
message:
Reduce selftest overhead to establish test names by memoization.
* TestUtil.py:
(TestLoader.getTestCaseNames): Memoize test names.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/TestUtil.py TestUtil.py-20050824080200-5f70140a2d938694
=== modified file 'NEWS'
--- a/NEWS 2008-01-05 01:54:01 +0000
+++ b/NEWS 2008-01-07 16:47:46 +0000
@@ -156,6 +156,9 @@
* Patience Diff now supports arbitrary python objects, as long as they
support ``hash()``. (John Arbash Meinel)
+ * Reduce selftest overhead to establish test names by memoization.
+ (Vincent Ladeuil)
+
API BREAKS:
TESTING:
=== modified file 'bzrlib/tests/TestUtil.py'
--- a/bzrlib/tests/TestUtil.py 2007-12-19 09:32:56 +0000
+++ b/bzrlib/tests/TestUtil.py 2008-01-07 16:47:46 +0000
@@ -77,6 +77,8 @@
"""Custom TestLoader to extend the stock python one."""
suiteClass = TestSuite
+ # Memoize test names by test class dict
+ test_func_names = {}
def loadTestsFromModuleNames(self, names):
"""use a custom means to load tests from modules.
@@ -122,6 +124,16 @@
else:
return basic_tests
+ def getTestCaseNames(self, test_case_class):
+ test_fn_names = self.test_func_names.get(test_case_class, None)
+ if test_fn_names is not None:
+ # We already calculate that
+ return test_fn_names
+
+ test_fn_names = unittest.TestLoader.getTestCaseNames(self,
+ test_case_class)
+ self.test_func_names[test_case_class] = test_fn_names
+ return test_fn_names
def _load_module_by_name(mod_name):
parts = mod_name.split('.')
More information about the bazaar-commits
mailing list