Rev 5804: Some cleanup. in file:///home/vila/src/bzr/experimental/config/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Jun 14 13:15:33 UTC 2011
At file:///home/vila/src/bzr/experimental/config/
------------------------------------------------------------
revno: 5804
revision-id: v.ladeuil+lp at free.fr-20110614131533-l48dgb3hz9xqrhlk
parent: v.ladeuil+lp at free.fr-20110614131050-3n5dwwos27172r5g
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: selftest-config-stats
timestamp: Tue 2011-06-14 15:15:33 +0200
message:
Some cleanup.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2011-06-14 13:10:50 +0000
+++ b/bzrlib/tests/__init__.py 2011-06-14 13:15:33 +0000
@@ -1021,17 +1021,18 @@
test ends, use addDetail subunit API to record the counter values.
"""
self._counters = {}
- def add_counters():
+ def add_counter_details():
for k, v in self._counters.iteritems():
self.addDetail('%s' % (k,), content.text_content('%s' % (v,)))
self._counters = None
- self.addCleanup(add_counters)
+ self.addCleanup(add_counter_details)
def _install_config_stats_hooks(self):
"""Install config hooks to count hook calls.
"""
- def install_hook(hooks, prefix, hook_name):
+ def install_counter_hook(hooks, prefix, hook_name):
+ """Create a counter and install its associated hook"""
counter_name = '%s.%s' % (prefix, hook_name)
self._counters[counter_name] = 0
def increment_counter(name): self._counters[name] += 1
@@ -1045,7 +1046,7 @@
self.addCleanup(hooks.uninstall_named_hook, hook_name, label)
for hook_name in ('get', 'set', 'remove', 'load', 'save'):
- install_hook(config.ConfigHooks, 'config', hook_name)
+ install_counter_hook(config.ConfigHooks, 'config', hook_name)
# The OldConfigHooks are private and need special handling to protect
# against recursive tests (tests that run other tests), so we just do
@@ -1053,7 +1054,7 @@
# us.
self.overrideAttr(config, 'OldConfigHooks', config._OldConfigHooks())
for hook_name in ('get', 'set', 'remove', 'load', 'save'):
- install_hook(config.OldConfigHooks, 'old_config', hook_name)
+ install_counter_hook(config.OldConfigHooks, 'old_config', hook_name)
def _clear_debug_flags(self):
"""Prevent externally set debug flags affecting tests.
More information about the bazaar-commits
mailing list