[Python-checkins] cpython (merge 3.1 -> 3.2): Try to fix sporadic failure in test_thread/test_threading
antoine.pitrou
python-checkins at python.org
Mon Apr 4 22:00:52 CEST 2011
http://hg.python.org/cpython/rev/8d5ea25d79d0
changeset: 69143:8d5ea25d79d0
branch: 3.2
parent: 69140:8a2639fdf433
parent: 69142:04b5cd2f8c87
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Apr 04 22:00:10 2011 +0200
summary:
Try to fix sporadic failure in test_thread/test_threading
files:
Lib/test/lock_tests.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -149,7 +149,13 @@
# We run many threads in the hope that existing threads ids won't
# be recycled.
Bunch(f, 15).wait_for_finished()
- self.assertEqual(n, len(threading.enumerate()))
+ if len(threading.enumerate()) != n:
+ # There is a small window during which a Thread instance's
+ # target function has finished running, but the Thread is still
+ # alive and registered. Avoid spurious failures by waiting a
+ # bit more (seen on a buildbot).
+ time.sleep(0.4)
+ self.assertEqual(n, len(threading.enumerate()))
def test_timeout(self):
lock = self.locktype()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list