diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_concurrent_futures.py | 3 | ||||
-rw-r--r-- | Lib/test/test_decimal.py | 3 | ||||
-rw-r--r-- | Lib/test/test_smtplib.py | 4 | ||||
-rw-r--r-- | Lib/test/test_xmlrpc.py | 8 |
4 files changed, 15 insertions, 3 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 7bc733e..57dc994 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -772,6 +772,7 @@ class FutureTests(BaseTestCase): t.start() self.assertEqual(f1.result(timeout=5), 42) + t.join() def test_result_with_cancel(self): # TODO(brian@sweetapp.com): This test is timing dependent. @@ -785,6 +786,7 @@ class FutureTests(BaseTestCase): t.start() self.assertRaises(futures.CancelledError, f1.result, timeout=5) + t.join() def test_exception_with_timeout(self): self.assertRaises(futures.TimeoutError, @@ -813,6 +815,7 @@ class FutureTests(BaseTestCase): t.start() self.assertTrue(isinstance(f1.exception(timeout=5), OSError)) + t.join() @test.support.reap_threads def test_main(): diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 5d9da0e..5aea51e 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1618,6 +1618,9 @@ class ThreadingTest(unittest.TestCase): for sig in Signals[self.decimal]: self.assertFalse(DefaultContext.flags[sig]) + th1.join() + th2.join() + DefaultContext.prec = save_prec DefaultContext.Emax = save_emax DefaultContext.Emin = save_emin diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 4c9b7d3..040ad4e 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -611,7 +611,9 @@ class TooLongLineTests(unittest.TestCase): self.sock.settimeout(15) self.port = support.bind_port(self.sock) servargs = (self.evt, self.respdata, self.sock) - threading.Thread(target=server, args=servargs).start() + thread = threading.Thread(target=server, args=servargs) + thread.start() + self.addCleanup(thread.join) self.evt.wait() self.evt.clear() diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index f2b496a..c9099e0 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -755,7 +755,9 @@ class BaseServerTestCase(unittest.TestCase): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, self.request_count, self.requestHandler) - threading.Thread(target=self.threadFunc, args=serv_args).start() + thread = threading.Thread(target=self.threadFunc, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() @@ -1206,7 +1208,9 @@ class FailingServerTestCase(unittest.TestCase): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, 1) - threading.Thread(target=http_server, args=serv_args).start() + thread = threading.Thread(target=http_server, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() |