summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncore.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-14 21:40:56 (GMT)
committerGitHub <noreply@github.com>2017-09-14 21:40:56 (GMT)
commitb9b69003d91c6ea94b890ce24ed25686d30f1428 (patch)
tree51ff0c32353a7f82e02879bd7b8efd36ffc17ca9 /Lib/test/test_asyncore.py
parent167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 (diff)
downloadcpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.zip
cpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.tar.gz
cpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r--Lib/test/test_asyncore.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
index c8e9727..ee0c3b3 100644
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -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