Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e886047 + 45fdb45 commit 4333affCopy full SHA for 4333aff
1 file changed
Lib/test/lock_tests.py
@@ -149,7 +149,13 @@ def f():
149
# We run many threads in the hope that existing threads ids won't
150
# be recycled.
151
Bunch(f, 15).wait_for_finished()
152
- self.assertEqual(n, len(threading.enumerate()))
+ if len(threading.enumerate()) != n:
153
+ # There is a small window during which a Thread instance's
154
+ # target function has finished running, but the Thread is still
155
+ # alive and registered. Avoid spurious failures by waiting a
156
+ # bit more (seen on a buildbot).
157
+ time.sleep(0.4)
158
+ self.assertEqual(n, len(threading.enumerate()))
159
160
def test_timeout(self):
161
lock = self.locktype()
0 commit comments