diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-09-14 21:40:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 21:40:56 (GMT) |
commit | b9b69003d91c6ea94b890ce24ed25686d30f1428 (patch) | |
tree | 51ff0c32353a7f82e02879bd7b8efd36ffc17ca9 /Lib/test/test_queue.py | |
parent | 167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 (diff) | |
download | cpython-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_queue.py')
-rw-r--r-- | Lib/test/test_queue.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index e501669..35466c1 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -58,10 +58,7 @@ class BlockingTestMixin: block_func) return self.result finally: - thread.join(10) # make sure the thread terminates - if thread.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) + support.join_thread(thread, 10) # make sure the thread terminates # Call this instead if block_func is supposed to raise an exception. def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, @@ -77,10 +74,7 @@ class BlockingTestMixin: self.fail("expected exception of kind %r" % expected_exception_class) finally: - thread.join(10) # make sure the thread terminates - if thread.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) + support.join_thread(thread, 10) # make sure the thread terminates if not thread.startedEvent.is_set(): self.fail("trigger thread ended but event never set") |