bpo-30357 each test in test_thread waits until all spawned threads finish (#1583)

* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index b466138..2f9abe0 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -22,6 +22,7 @@
             print arg
 
 
+
 class BasicThreadTest(unittest.TestCase):
 
     def setUp(self):
@@ -33,6 +34,9 @@
         self.running = 0
         self.next_ident = 0
 
+        key = test_support.threading_setup()
+        self.addCleanup(test_support.threading_cleanup, *key)
+
 
 class ThreadRunningTests(BasicThreadTest):