66from concurrent import futures
77
88from test import support
9+ from test .support import warnings_helper
910from test .support .script_helper import assert_python_ok
1011
1112from .util import (
@@ -77,12 +78,14 @@ def run_last():
7778 self .assertIn ("RuntimeError: cannot schedule new futures" , err .decode ())
7879 self .assertEqual (out .strip (), b"runtime-error" )
7980
81+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
8082 def test_hang_issue12364 (self ):
8183 fs = [self .executor .submit (time .sleep , 0.1 ) for _ in range (50 )]
8284 self .executor .shutdown ()
8385 for f in fs :
8486 f .result ()
8587
88+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
8689 def test_cancel_futures (self ):
8790 assert self .worker_count <= 5 , "test needs few workers"
8891 fs = [self .executor .submit (time .sleep , .1 ) for _ in range (50 )]
@@ -128,6 +131,7 @@ def test_hang_gh83386(self):
128131 self .assertFalse (err )
129132 self .assertEqual (out .strip (), b"apple" )
130133
134+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
131135 def test_hang_gh94440 (self ):
132136 """shutdown(wait=True) doesn't hang when a future was submitted and
133137 quickly canceled right before shutdown.
@@ -171,6 +175,7 @@ def acquire_lock(lock):
171175 for t in self .executor ._threads :
172176 t .join ()
173177
178+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
174179 def test_context_manager_shutdown (self ):
175180 with futures .ThreadPoolExecutor (max_workers = 5 ) as e :
176181 executor = e
@@ -180,6 +185,7 @@ def test_context_manager_shutdown(self):
180185 for t in executor ._threads :
181186 t .join ()
182187
188+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
183189 def test_del_shutdown (self ):
184190 executor = futures .ThreadPoolExecutor (max_workers = 5 )
185191 res = executor .map (abs , range (- 5 , 5 ))
@@ -193,6 +199,7 @@ def test_del_shutdown(self):
193199 # executor got shutdown.
194200 assert all ([r == abs (v ) for r , v in zip (res , range (- 5 , 5 ))])
195201
202+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
196203 def test_shutdown_no_wait (self ):
197204 # Ensure that the executor cleans up the threads when calling
198205 # shutdown with wait=False
@@ -207,7 +214,7 @@ def test_shutdown_no_wait(self):
207214 # executor got shutdown.
208215 assert all ([r == abs (v ) for r , v in zip (res , range (- 5 , 5 ))])
209216
210-
217+ @ warnings_helper . ignore_warnings ( category = DeprecationWarning ) # gh-135427
211218 def test_thread_names_assigned (self ):
212219 executor = futures .ThreadPoolExecutor (
213220 max_workers = 5 , thread_name_prefix = 'SpecialPool' )
@@ -220,6 +227,7 @@ def test_thread_names_assigned(self):
220227 self .assertRegex (t .name , r'^SpecialPool_[0-4]$' )
221228 t .join ()
222229
230+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
223231 def test_thread_names_default (self ):
224232 executor = futures .ThreadPoolExecutor (max_workers = 5 )
225233 executor .map (abs , range (- 5 , 5 ))
@@ -253,6 +261,7 @@ def test_cancel_futures_wait_false(self):
253261
254262
255263class ProcessPoolShutdownTest (ExecutorShutdownTest ):
264+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
256265 def test_processes_terminate (self ):
257266 def acquire_lock (lock ):
258267 lock .acquire ()
@@ -276,6 +285,7 @@ def acquire_lock(lock):
276285 for p in processes .values ():
277286 p .join ()
278287
288+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
279289 def test_context_manager_shutdown (self ):
280290 with futures .ProcessPoolExecutor (
281291 max_workers = 5 , mp_context = self .get_context ()) as e :
@@ -286,6 +296,7 @@ def test_context_manager_shutdown(self):
286296 for p in processes .values ():
287297 p .join ()
288298
299+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
289300 def test_del_shutdown (self ):
290301 executor = futures .ProcessPoolExecutor (
291302 max_workers = 5 , mp_context = self .get_context ())
@@ -308,6 +319,7 @@ def test_del_shutdown(self):
308319 # executor got shutdown.
309320 assert all ([r == abs (v ) for r , v in zip (res , range (- 5 , 5 ))])
310321
322+ @warnings_helper .ignore_warnings (category = DeprecationWarning ) # gh-135427
311323 def test_shutdown_no_wait (self ):
312324 # Ensure that the executor cleans up the processes when calling
313325 # shutdown with wait=False
0 commit comments