Skip to content

Commit 41e8337

Browse files
committed
WIP - more suppress of warnings.
1 parent 8731cba commit 41e8337

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Lib/test/test_concurrent_futures/test_as_completed.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
CANCELLED_AND_NOTIFIED, FINISHED, Future)
88

99
from test import support
10+
from test.support import warnings_helper
1011

1112
from .util import (
1213
PENDING_FUTURE, RUNNING_FUTURE,
@@ -19,6 +20,7 @@ def mul(x, y):
1920

2021

2122
class AsCompletedTests:
23+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
2224
def test_no_timeout(self):
2325
future1 = self.executor.submit(mul, 2, 21)
2426
future2 = self.executor.submit(mul, 7, 6)
@@ -35,6 +37,7 @@ def test_no_timeout(self):
3537
future1, future2]),
3638
completed)
3739

40+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
3841
def test_future_times_out(self):
3942
"""Test ``futures.as_completed`` timing out before
4043
completing it's final future."""
@@ -62,6 +65,7 @@ def test_future_times_out(self):
6265
# Check that ``future`` wasn't completed.
6366
self.assertEqual(completed_futures, already_completed)
6467

68+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
6569
def test_duplicate_futures(self):
6670
# Issue 20367. Duplicate futures should not raise exceptions or give
6771
# duplicate responses.

Lib/test/test_concurrent_futures/test_shutdown.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from concurrent import futures
77

88
from test import support
9+
from test.support import warnings_helper
910
from test.support.script_helper import assert_python_ok
1011

1112
from .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

255263
class 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

Comments
 (0)