Rev 3147: Reduce selftest overhead to establish test names by memoization. in file:///v/home/vila/src/bzr/experimental/selftest/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat Dec 29 12:01:31 GMT 2007
At file:///v/home/vila/src/bzr/experimental/selftest/
------------------------------------------------------------
revno: 3147
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
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-12-26 21:13:53 +0000
+++ b/NEWS 2007-12-29 12:01:25 +0000
@@ -118,6 +118,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-18 07:29:14 +0000
+++ b/bzrlib/tests/TestUtil.py 2007-12-29 12:01:25 +0000
@@ -73,6 +73,10 @@
visitTests(self, visitor)
+# Memoize test names
+test_func_names = {}
+
+
class TestLoader(unittest.TestLoader):
"""Custom TestLoader to extend the stock python one."""
@@ -122,6 +126,15 @@
else:
return basic_tests
+ def getTestCaseNames(self, testCaseClass):
+ testFnNames = test_func_names.get(testCaseClass, None)
+ if testFnNames is not None:
+ # We already calculate that
+ return testFnNames
+
+ testFnNames = unittest.TestLoader.getTestCaseNames(self, testCaseClass)
+ test_func_names[testCaseClass] = testFnNames
+ return testFnNames
def _load_module_by_name(mod_name):
parts = mod_name.split('.')
More information about the bazaar-commits
mailing list