summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-04-04 19:59:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-04-04 19:59:09 (GMT)
commit45fdb457da43da417796c465ebac3cec0beeb1bf (patch)
tree01ffadaddcdf74b4e2e95e3d8a15aea453ca8fe9 /Lib/test
parentb35f29a0e061841711529ebfad2d24f7334696dd (diff)
downloadcpython-45fdb457da43da417796c465ebac3cec0beeb1bf.zip
cpython-45fdb457da43da417796c465ebac3cec0beeb1bf.tar.gz
cpython-45fdb457da43da417796c465ebac3cec0beeb1bf.tar.bz2
Try to fix sporadic failure in test_thread/test_threading
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/lock_tests.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 04f7422..22c6900 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -141,7 +141,13 @@ class BaseLockTests(BaseTestCase):
# 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()))
class LockTests(BaseLockTests):