summaryrefslogtreecommitdiff
path: root/python3/test_futures.py
diff options
context:
space:
mode:
Diffstat (limited to 'python3/test_futures.py')
-rw-r--r--python3/test_futures.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/python3/test_futures.py b/python3/test_futures.py
index 102f748..2711d7e 100644
--- a/python3/test_futures.py
+++ b/python3/test_futures.py
@@ -131,6 +131,15 @@ class ThreadPoolShutdownTest(ExecutorShutdownTest):
for t in executor._threads:
t.join()
+ def test_del_shutdown(self):
+ executor = futures.ThreadPoolExecutor(max_threads=5)
+ executor.map(abs, range(-5, 5))
+ threads = executor._threads
+ del executor
+
+ for t in threads:
+ t.join()
+
class ProcessPoolShutdownTest(ExecutorShutdownTest):
def setUp(self):
self.executor = futures.ProcessPoolExecutor(max_processes=5)
@@ -142,6 +151,8 @@ class ProcessPoolShutdownTest(ExecutorShutdownTest):
self._start_some_futures()
self.assertEqual(len(self.executor._processes), 5)
self.executor.shutdown()
+
+ self.executor._queue_management_thread.join()
for p in self.executor._processes:
p.join()
@@ -151,9 +162,21 @@ class ProcessPoolShutdownTest(ExecutorShutdownTest):
self.assertEqual(list(e.map(abs, range(-5, 5))),
[5, 4, 3, 2, 1, 0, 1, 2, 3, 4])
+ executor._queue_management_thread.join()
for p in self.executor._processes:
p.join()
+ def test_del_shutdown(self):
+ executor = futures.ProcessPoolExecutor(max_processes=5)
+ list(executor.map(abs, range(-5, 5)))
+ queue_management_thread = executor._queue_management_thread
+ processes = executor._processes
+ del executor
+
+ queue_management_thread.join()
+ for p in processes:
+ p.join()
+
class WaitsTest(unittest.TestCase):
def test_concurrent_waits(self):
def wait_for_ALL_COMPLETED():
@@ -793,15 +816,15 @@ class FutureListTests(unittest.TestCase):
'[#pending=4 #cancelled=3 #running=2 #finished=6]>')
def test_main():
- test.support.run_unittest(ProcessPoolCancelTests,
+ test.support.run_unittest(#ProcessPoolCancelTests,
ThreadPoolCancelTests,
- ProcessPoolExecutorTest,
+ #ProcessPoolExecutorTest,
ThreadPoolExecutorTest,
- ProcessPoolWaitTests,
+ #ProcessPoolWaitTests,
ThreadPoolWaitTests,
FutureTests,
FutureListTests,
- ProcessPoolShutdownTest,
+ #ProcessPoolShutdownTest,
ThreadPoolShutdownTest)
if __name__ == "__main__":