Skip to content

Commit 204c642

Browse files
committed
WIP - more suppression of warnings
1 parent 5277d4c commit 204c642

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

Lib/test/test_concurrent_futures/executor.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from concurrent import futures
66
from operator import add
77
from test import support
8-
from test.support import Py_GIL_DISABLED
8+
from test.support import Py_GIL_DISABLED, warnings_helper
99

1010

1111
def mul(x, y):
@@ -43,10 +43,12 @@ class ExecutorTest:
4343

4444
# Executor.shutdown() and context manager usage is tested by
4545
# ExecutorShutdownTest.
46+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
4647
def test_submit(self):
4748
future = self.executor.submit(pow, 2, 8)
4849
self.assertEqual(256, future.result())
4950

51+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
5052
def test_submit_keyword(self):
5153
future = self.executor.submit(mul, 2, y=8)
5254
self.assertEqual(16, future.result())
@@ -57,6 +59,7 @@ def test_submit_keyword(self):
5759
with self.assertRaises(TypeError):
5860
self.executor.submit(arg=1)
5961

62+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
6063
def test_map(self):
6164
self.assertEqual(
6265
list(self.executor.map(pow, range(10), range(10))),
@@ -66,6 +69,7 @@ def test_map(self):
6669
list(self.executor.map(pow, range(10), range(10), chunksize=3)),
6770
list(map(pow, range(10), range(10))))
6871

72+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
6973
def test_map_exception(self):
7074
i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5])
7175
self.assertEqual(i.__next__(), (0, 1))
@@ -108,20 +112,23 @@ def test_map_buffersize_value_validation(self):
108112
):
109113
self.executor.map(str, range(4), buffersize=buffersize)
110114

115+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
111116
def test_map_buffersize(self):
112117
ints = range(4)
113118
for buffersize in (1, 2, len(ints), len(ints) * 2):
114119
with self.subTest(buffersize=buffersize):
115120
res = self.executor.map(str, ints, buffersize=buffersize)
116121
self.assertListEqual(list(res), ["0", "1", "2", "3"])
117122

123+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
118124
def test_map_buffersize_on_multiple_iterables(self):
119125
ints = range(4)
120126
for buffersize in (1, 2, len(ints), len(ints) * 2):
121127
with self.subTest(buffersize=buffersize):
122128
res = self.executor.map(add, ints, ints, buffersize=buffersize)
123129
self.assertListEqual(list(res), [0, 2, 4, 6])
124130

131+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
125132
def test_map_buffersize_on_infinite_iterable(self):
126133
res = self.executor.map(str, itertools.count(), buffersize=2)
127134
self.assertEqual(next(res, None), "0")
@@ -147,6 +154,7 @@ def test_map_buffersize_without_iterable(self):
147154
res = self.executor.map(str, buffersize=2)
148155
self.assertIsNone(next(res, None))
149156

157+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
150158
def test_map_buffersize_when_buffer_is_full(self):
151159
ints = iter(range(4))
152160
buffersize = 2
@@ -158,13 +166,15 @@ def test_map_buffersize_when_buffer_is_full(self):
158166
msg="should have fetched only `buffersize` elements from `ints`.",
159167
)
160168

169+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
161170
def test_shutdown_race_issue12456(self):
162171
# Issue #12456: race condition at shutdown where trying to post a
163172
# sentinel in the call queue blocks (the queue is full while processes
164173
# have exited).
165174
self.executor.map(str, [2] * (self.worker_count + 1))
166175
self.executor.shutdown()
167176

177+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
168178
@support.cpython_only
169179
def test_no_stale_references(self):
170180
# Issue #16284: check that the executors don't unnecessarily hang onto
@@ -209,6 +219,7 @@ def test_max_workers_negative(self):
209219
"than 0"):
210220
self.executor_type(max_workers=number)
211221

222+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
212223
def test_free_reference(self):
213224
# Issue #14406: Result iterator should not keep an internal
214225
# reference to result objects.
@@ -221,6 +232,7 @@ def test_free_reference(self):
221232
if wr() is None:
222233
break
223234

235+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
224236
def test_swallows_falsey_exceptions(self):
225237
# see gh-132063: Prevent exceptions that evaluate as falsey
226238
# from being ignored.

Lib/test/test_concurrent_futures/test_process_pool.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from concurrent.futures.process import BrokenProcessPool
1010

1111
from test import support
12-
from test.support import hashlib_helper
12+
from test.support import hashlib_helper, warnings_helper
1313
from test.test_importlib.metadata.fixtures import parameterize
1414

1515
from .executor import ExecutorTest, mul
@@ -49,6 +49,7 @@ def test_max_workers_too_large(self):
4949
"max_workers must be <= 61"):
5050
futures.ProcessPoolExecutor(max_workers=62)
5151

52+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
5253
def test_killed_child(self):
5354
# When a child process is abruptly terminated, the whole pool gets
5455
# "broken".
@@ -61,6 +62,7 @@ def test_killed_child(self):
6162
# Submitting other jobs fails as well.
6263
self.assertRaises(BrokenProcessPool, self.executor.submit, pow, 2, 8)
6364

65+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
6466
def test_map_chunksize(self):
6567
def bad_map():
6668
list(self.executor.map(pow, range(40), range(40), chunksize=-1))
@@ -81,6 +83,7 @@ def bad_map():
8183
def _test_traceback(cls):
8284
raise RuntimeError(123) # some comment
8385

86+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
8487
def test_traceback(self):
8588
# We want ensure that the traceback from the child process is
8689
# contained in the traceback raised in the main process.
@@ -103,6 +106,7 @@ def test_traceback(self):
103106
self.assertIn('raise RuntimeError(123) # some comment',
104107
f1.getvalue())
105108

109+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
106110
@hashlib_helper.requires_hashdigest('md5')
107111
def test_ressources_gced_in_workers(self):
108112
# Ensure that argument for a job are correctly gc-ed after the job
@@ -123,6 +127,7 @@ def test_ressources_gced_in_workers(self):
123127
mgr.shutdown()
124128
mgr.join()
125129

130+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
126131
def test_saturation(self):
127132
executor = self.executor
128133
mp_context = self.get_context()
@@ -208,6 +213,7 @@ def test_max_tasks_early_shutdown(self):
208213
for i, future in enumerate(futures):
209214
self.assertEqual(future.result(), mul(i, i))
210215

216+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
211217
def test_python_finalization_error(self):
212218
# gh-109047: Catch RuntimeError on thread creation
213219
# during Python finalization.
@@ -258,6 +264,7 @@ def test_force_shutdown_workers_invalid_op(self):
258264
executor._force_shutdown,
259265
operation='invalid operation'),
260266

267+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
261268
@parameterize(*FORCE_SHUTDOWN_PARAMS)
262269
def test_force_shutdown_workers(self, function_name):
263270
manager = self.get_context().Manager()

0 commit comments

Comments
 (0)