summaryrefslogtreecommitdiff
path: root/Lib/test/test_sched.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-14 14:40:56 -0700
committerGitHub <noreply@github.com>2017-09-14 14:40:56 -0700
commitb9b69003d91c6ea94b890ce24ed25686d30f1428 (patch)
tree51ff0c32353a7f82e02879bd7b8efd36ffc17ca9 /Lib/test/test_sched.py
parent167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 (diff)
downloadcpython-git-b9b69003d91c6ea94b890ce24ed25686d30f1428.tar.gz
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_sched.py')
-rw-r--r--Lib/test/test_sched.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
index 794c6374c4..3f84af2a4c 100644
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -3,6 +3,7 @@ import sched
import threading
import time
import unittest
+from test import support
TIMEOUT = 10
@@ -81,8 +82,7 @@ class TestCase(unittest.TestCase):
self.assertEqual(q.get(timeout=TIMEOUT), 5)
self.assertTrue(q.empty())
timer.advance(1000)
- t.join(timeout=TIMEOUT)
- self.assertFalse(t.is_alive())
+ support.join_thread(t, timeout=TIMEOUT)
self.assertTrue(q.empty())
self.assertEqual(timer.time(), 5)
@@ -137,8 +137,7 @@ class TestCase(unittest.TestCase):
self.assertEqual(q.get(timeout=TIMEOUT), 4)
self.assertTrue(q.empty())
timer.advance(1000)
- t.join(timeout=TIMEOUT)
- self.assertFalse(t.is_alive())
+ support.join_thread(t, timeout=TIMEOUT)
self.assertTrue(q.empty())
self.assertEqual(timer.time(), 4)