Rev 3902: Clear out the InventoryEntry caches as part of the test suite. in http://bzr.arbash-meinel.com/branches/bzr/1.11/xml_cache
John Arbash Meinel
john at arbash-meinel.com
Thu Dec 11 22:22:38 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.11/xml_cache
------------------------------------------------------------
revno: 3902
revision-id: john at arbash-meinel.com-20081211222229-c9l7lebfgrzb5pme
parent: john at arbash-meinel.com-20081211213610-p2ovasy20mc5a2j1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xml_cache
timestamp: Thu 2008-12-11 16:22:29 -0600
message:
Clear out the InventoryEntry caches as part of the test suite.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2008-12-11 03:08:03 +0000
+++ b/bzrlib/tests/__init__.py 2008-12-11 22:22:29 +0000
@@ -771,6 +771,7 @@
self._benchtime = None
self._clear_hooks()
self._clear_debug_flags()
+ self._clear_caches()
TestCase._active_threads = threading.activeCount()
self.addCleanup(self._check_leaked_threads)
@@ -787,9 +788,18 @@
# to a TestCase object.
atexit.register(_report_leaked_threads)
+ def _clear_caches(self):
+ from bzrlib import xml5, xml6, xml7, xml8
+ # Many tests re-use the same revision ids, so the entry caches are not
+ # valid
+ xml5.serializer_v5._entry_cache.clear()
+ xml6.serializer_v6._entry_cache.clear()
+ xml7.serializer_v7._entry_cache.clear()
+ xml8.serializer_v8._entry_cache.clear()
+
def _clear_debug_flags(self):
"""Prevent externally set debug flags affecting tests.
-
+
Tests that want to use debug flags can just set them in the
debug_flags set during setup/teardown.
"""
More information about the bazaar-commits
mailing list