summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-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):