~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2008-12-11 22:22:29 UTC
  • mto: This revision was merged to the branch mainline in revision 3912.
  • Revision ID: john@arbash-meinel.com-20081211222229-c9l7lebfgrzb5pme
Clear out the InventoryEntry caches as part of the test suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
771
771
        self._benchtime = None
772
772
        self._clear_hooks()
773
773
        self._clear_debug_flags()
 
774
        self._clear_caches()
774
775
        TestCase._active_threads = threading.activeCount()
775
776
        self.addCleanup(self._check_leaked_threads)
776
777
 
787
788
                # to a TestCase object.
788
789
                atexit.register(_report_leaked_threads)
789
790
 
 
791
    def _clear_caches(self):
 
792
        from bzrlib import xml5, xml6, xml7, xml8
 
793
        # Many tests re-use the same revision ids, so the entry caches are not
 
794
        # valid
 
795
        xml5.serializer_v5._entry_cache.clear()
 
796
        xml6.serializer_v6._entry_cache.clear()
 
797
        xml7.serializer_v7._entry_cache.clear()
 
798
        xml8.serializer_v8._entry_cache.clear()
 
799
 
790
800
    def _clear_debug_flags(self):
791
801
        """Prevent externally set debug flags affecting tests.
792
 
        
 
802
 
793
803
        Tests that want to use debug flags can just set them in the
794
804
        debug_flags set during setup/teardown.
795
805
        """