Skip to content

Commit ae3a5ed

Browse files
committed
WIP - suppressing warnings in tests that fail in the tests running online
1 parent d5336dc commit ae3a5ed

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

Lib/test/test_asyncio/test_unix_events.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from unittest import mock
1616

1717
from test import support
18-
from test.support import os_helper
18+
from test.support import os_helper, warnings_helper
1919
from test.support import socket_helper
2020
from test.support import wait_process
2121
from test.support import hashlib_helper
@@ -1182,6 +1182,7 @@ async def runner():
11821182
@support.requires_fork()
11831183
class TestFork(unittest.IsolatedAsyncioTestCase):
11841184

1185+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
11851186
async def test_fork_not_share_event_loop(self):
11861187
# The forked process should not share the event loop with the parent
11871188
loop = asyncio.get_running_loop()
@@ -1206,6 +1207,7 @@ async def test_fork_not_share_event_loop(self):
12061207
self.assertEqual(result, b'NO LOOP')
12071208
wait_process(pid, exitcode=0)
12081209

1210+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
12091211
@hashlib_helper.requires_hashdigest('md5')
12101212
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
12111213
def test_fork_signal_handling(self):
@@ -1253,6 +1255,7 @@ async def func():
12531255
self.assertFalse(parent_handled.is_set())
12541256
self.assertTrue(child_handled.is_set())
12551257

1258+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
12561259
@hashlib_helper.requires_hashdigest('md5')
12571260
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
12581261
def test_fork_asyncio_run(self):
@@ -1273,6 +1276,7 @@ async def child_main():
12731276

12741277
self.assertEqual(result.value, 42)
12751278

1279+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
12761280
@hashlib_helper.requires_hashdigest('md5')
12771281
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
12781282
def test_fork_asyncio_subprocess(self):

Lib/test/test_builtin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from test import support
3232
from test.support import cpython_only, swap_attr
3333
from test.support import async_yield, run_yielding_async_fn
34+
from test.support import warnings_helper
3435
from test.support.import_helper import import_module
3536
from test.support.os_helper import (EnvironmentVarGuard, TESTFN, unlink)
3637
from test.support.script_helper import assert_python_ok
@@ -2545,6 +2546,7 @@ def run_child(self, child, terminal_input):
25452546
finally:
25462547
signal.signal(signal.SIGHUP, old_sighup)
25472548

2549+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
25482550
def _run_child(self, child, terminal_input):
25492551
r, w = os.pipe() # Pipe test results from child back to parent
25502552
try:

Lib/test/test_fork1.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from test.fork_wait import ForkWait
1313
from test import support
14+
from test.support import warnings_helper
1415

1516

1617
# Skip test if fork does not exist.
@@ -19,6 +20,7 @@
1920

2021

2122
class ForkTest(ForkWait):
23+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
2224
def test_threaded_import_lock_fork(self):
2325
"""Check fork() in main thread works while a subthread is doing an import"""
2426
import_started = threading.Event()
@@ -61,7 +63,7 @@ def importer():
6163
except OSError:
6264
pass
6365

64-
66+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
6567
def test_nested_import_lock_fork(self):
6668
"""Check fork() in main thread works while the main thread is doing an import"""
6769
exitcode = 42

Lib/test/test_mailbox.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io
99
import tempfile
1010
from test import support
11-
from test.support import import_helper
11+
from test.support import import_helper, warnings_helper
1212
from test.support import os_helper
1313
from test.support import refleak_helper
1414
from test.support import socket_helper
@@ -1212,6 +1212,7 @@ def test_add_and_close(self):
12121212
self.assertEqual(contents, f.read())
12131213
self._box = self._factory(self._path)
12141214

1215+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
12151216
@support.requires_fork()
12161217
@unittest.skipUnless(hasattr(socket, 'socketpair'), "Test needs socketpair().")
12171218
def test_lock_conflict(self):

Lib/test/test_pty.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22
from test.support import (
3-
is_android, is_apple_mobile, is_emscripten, is_wasi, reap_children, verbose
3+
is_android, is_apple_mobile, is_emscripten, is_wasi, reap_children, verbose, warnings_helper
44
)
55
from test.support.import_helper import import_module
66
from test.support.os_helper import TESTFN, unlink
@@ -194,6 +194,7 @@ def test_openpty(self):
194194
s2 = _readline(master_fd)
195195
self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))
196196

197+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
197198
def test_fork(self):
198199
debug("calling pty.fork()")
199200
pid, master_fd = pty.fork()
@@ -295,6 +296,7 @@ def test_master_read(self):
295296

296297
self.assertEqual(data, b"")
297298

299+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
298300
def test_spawn_doesnt_hang(self):
299301
self.addCleanup(unlink, TESTFN)
300302
with open(TESTFN, 'wb') as f:

Lib/test/test_random.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from fractions import Fraction
1515
from collections import abc, Counter
1616

17+
from test.support import warnings_helper
18+
1719

1820
class MyIndex:
1921
def __init__(self, value):
@@ -1399,6 +1401,7 @@ def test__all__(self):
13991401
# tests validity but not completeness of the __all__ list
14001402
self.assertTrue(set(random.__all__) <= set(dir(random)))
14011403

1404+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
14021405
@test.support.requires_fork()
14031406
def test_after_fork(self):
14041407
# Test the global Random instance gets reseeded in child

Lib/test/test_support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ def test_check__all__(self):
484484

485485
self.assertRaises(AssertionError, support.check__all__, self, unittest)
486486

487+
@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
487488
@unittest.skipUnless(hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG'),
488489
'need os.waitpid() and os.WNOHANG')
489490
@support.requires_fork()

0 commit comments

Comments
 (0)