At file:///home/pqm/archives/thelove/bzr/%2Btrunk/ ------------------------------------------------------------ revno: 4739 [merge] revision-id: [email protected] parent: [email protected] parent: [email protected] committer: Canonical.com Patch Queue Manager <[email protected]> branch nick: +trunk timestamp: Tue 2009-10-13 10:29:44 +0100 message: (vila) Clearer thread leaks reports modified: bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64 === modified file 'bzrlib/tests/__init__.py' --- a/bzrlib/tests/__init__.py 2009-10-12 17:03:40 +0000 +++ b/bzrlib/tests/__init__.py 2009-10-13 08:46:44 +0000 @@ -222,6 +222,10 @@ '%s is leaking threads among %d leaking tests.\n' % ( TestCase._first_thread_leaker_id, TestCase._leaking_threads_tests)) + # We don't report the main thread as an active one. + self.stream.write( + '%d non-main threads were left active in the end.\n' + % (TestCase._active_threads - 1)) def _extractBenchmarkTime(self, testCase): """Add a benchmark time for the current test case.""" @@ -846,7 +850,13 @@ active = threading.activeCount() leaked_threads = active - TestCase._active_threads TestCase._active_threads = active - if leaked_threads: + # If some tests make the number of threads *decrease*, we'll consider + # that they are just observing old threads dieing, not agressively kill + # random threads. So we don't report these tests as leaking. The risk + # is that we have false positives that way (the test see 2 threads + # going away but leak one) but it seems less likely than the actual + # false positives (the test see threads going away and does not leak). + if leaked_threads > 0: TestCase._leaking_threads_tests += 1 if TestCase._first_thread_leaker_id is None: TestCase._first_thread_leaker_id = self.id()
-- bazaar-commits mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/bazaar-commits
