mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the thread is still alive after timeout seconds.
This commit is contained in:
parent
167cbde50a
commit
b9b69003d9
9 changed files with 50 additions and 65 deletions
|
@ -360,9 +360,7 @@ class DispatcherWithSendTests(unittest.TestCase):
|
|||
|
||||
self.assertEqual(cap.getvalue(), data*2)
|
||||
finally:
|
||||
t.join(timeout=TIMEOUT)
|
||||
if t.is_alive():
|
||||
self.fail("join() timed out")
|
||||
support.join_thread(t, timeout=TIMEOUT)
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(asyncore, 'file_wrapper'),
|
||||
|
@ -794,9 +792,7 @@ class BaseTestAPI:
|
|||
except OSError:
|
||||
pass
|
||||
finally:
|
||||
t.join(timeout=TIMEOUT)
|
||||
if t.is_alive():
|
||||
self.fail("join() timed out")
|
||||
support.join_thread(t, timeout=TIMEOUT)
|
||||
|
||||
class TestAPI_UseIPv4Sockets(BaseTestAPI):
|
||||
family = socket.AF_INET
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue