diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-04 20:00:10 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-04 20:00:10 (GMT) |
commit | 4333affb74f29d46d28ba2b202aa9ff48716cab2 (patch) | |
tree | 99f591136d9bb207a386f7deda4ddf3682a7b466 /Lib/test | |
parent | e88604755c90b52858ecc17e2a3548bfed20c45f (diff) | |
parent | 45fdb457da43da417796c465ebac3cec0beeb1bf (diff) | |
download | cpython-4333affb74f29d46d28ba2b202aa9ff48716cab2.zip cpython-4333affb74f29d46d28ba2b202aa9ff48716cab2.tar.gz cpython-4333affb74f29d46d28ba2b202aa9ff48716cab2.tar.bz2 |
Try to fix sporadic failure in test_thread/test_threading
Diffstat (limited to 'Lib/test')
-rw-r--r-- | 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 index 005c912..ff30d41 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -149,7 +149,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())) def test_timeout(self): lock = self.locktype() |