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.
t.start()
self.assertRaises(futures.CancelledError, f1.result, timeout=5)
+ t.join()
def test_exception_with_timeout(self):
self.assertRaises(futures.TimeoutError,
t.start()
self.assertTrue(isinstance(f1.exception(timeout=5), OSError))
+ t.join()
@test.support.reap_threads
def test_main():
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
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()
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()
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()