Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6622c55
gh-135427: Fix DeprecationWarning for os.fork when run in threads wit…
rani-pinchuk Jul 19, 2025
7b13bdc
Merge branch 'main' into fix-issue-135427
rani-pinchuk Jul 19, 2025
bf97fe0
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 19, 2025
3482918
gh-135427: check that exception occured, and also clear later the exc…
rani-pinchuk Jul 19, 2025
ce90d77
Merge remote-tracking branch 'refs/remotes/origin/fix-issue-135427' i…
rani-pinchuk Jul 19, 2025
1a20748
Behavior changed to raise an exception when fork is used within a thr…
rani-pinchuk Jul 20, 2025
9bead0e
Seems like test_multiprocessing fork deprecation warnings are suppres…
rani-pinchuk Jul 20, 2025
d5336dc
Warning of deprecated fork are suppressed in more tests.
rani-pinchuk Jul 20, 2025
ae3a5ed
WIP - suppressing warnings in tests that fail in the tests running on…
rani-pinchuk Jul 20, 2025
f768f5d
WIP - continuing suppressing warnings in tests.
rani-pinchuk Jul 21, 2025
6308e19
WIP - fix imports.
rani-pinchuk Jul 21, 2025
8955136
WIP - more suppressing of warnings
rani-pinchuk Jul 21, 2025
8731cba
WIP - fix ignore_warnings to wrap also async functions
rani-pinchuk Jul 21, 2025
41e8337
WIP - more suppress of warnings.
rani-pinchuk Jul 21, 2025
359b0ed
WIP - more suppress of warnings.
rani-pinchuk Jul 21, 2025
5277d4c
WIP - test.test_multiprocessing_fork gives no errors on local ubuntu …
rani-pinchuk Jul 21, 2025
204c642
WIP - more suppression of warnings
rani-pinchuk Jul 22, 2025
1b44537
WIP - adding more suppressing of the DeprecatinoWarning
rani-pinchuk Jul 22, 2025
c43b3c0
WIP - more suppress of warnings.
rani-pinchuk Jul 22, 2025
5d7ae0c
Merge branch 'main' into fix-issue-135427
rani-pinchuk Jul 22, 2025
868ffd6
WIP - more suppress of warnings.
rani-pinchuk Jul 22, 2025
e1398d8
Add dedicated decorator to ignore only the fork in thread deprecation…
rani-pinchuk Jul 24, 2025
b58b2ca
Replace the generic decorators to ignore deprecation errors with spec…
rani-pinchuk Jul 24, 2025
8d832ac
Linting issue
rani-pinchuk Jul 24, 2025
a0fc743
Update Modules/posixmodule.c
rani-pinchuk Jul 31, 2025
5d1d553
Update Misc/NEWS.d/next/Library/2025-07-19-11-53-19.gh-issue-135427.i…
rani-pinchuk Jul 31, 2025
5a80e4a
Simply ignore_warning functions
rani-pinchuk Jul 31, 2025
52f6f97
Linting fix
rani-pinchuk Jul 31, 2025
36147a1
Remove Misc/mypy/_colorize.py - should be a symlink
rani-pinchuk Jul 31, 2025
baab332
Remove Misc/mypy/_token.py and Misc/mypy/_pyrelp - should be a symlink
rani-pinchuk Jul 31, 2025
244869e
Ignore the symlinked files
rani-pinchuk Jul 31, 2025
8b699d8
Fix warning for asymc function
rani-pinchuk Jul 31, 2025
1cc929b
Update Lib/test/_test_multiprocessing.py
rani-pinchuk Aug 12, 2025
3d954be
Merge in the main branch
encukou Aug 12, 2025
7ee8c23
Restore files in Misc
encukou Aug 12, 2025
c0ebdf1
Use the helper in more setUp methods
encukou Aug 21, 2025
4bf706d
Merge in the main branch
encukou Aug 21, 2025
a95785d
Remove unused import
encukou Aug 21, 2025
80172be
Add required import ^^;
encukou Aug 21, 2025
baa8446
Remove accidentally-committed summary
encukou Aug 21, 2025
776e2b7
Merge in the main branch
encukou Aug 25, 2025
b08021d
Add decorator to new tests
encukou Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP - suppressing warnings in tests that fail in the tests running on…
…line
  • Loading branch information
rani-pinchuk committed Jul 20, 2025
commit ae3a5ed6a4c71743fb8a7b94ec52aea90a813546
6 changes: 5 additions & 1 deletion Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from unittest import mock

from test import support
from test.support import os_helper
from test.support import os_helper, warnings_helper
from test.support import socket_helper
from test.support import wait_process
from test.support import hashlib_helper
Expand Down Expand Up @@ -1182,6 +1182,7 @@ async def runner():
@support.requires_fork()
class TestFork(unittest.IsolatedAsyncioTestCase):

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
Comment thread
encukou marked this conversation as resolved.
Outdated
Comment thread
encukou marked this conversation as resolved.
Outdated
async def test_fork_not_share_event_loop(self):
# The forked process should not share the event loop with the parent
loop = asyncio.get_running_loop()
Expand All @@ -1206,6 +1207,7 @@ async def test_fork_not_share_event_loop(self):
self.assertEqual(result, b'NO LOOP')
wait_process(pid, exitcode=0)

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

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

self.assertEqual(result.value, 42)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
@hashlib_helper.requires_hashdigest('md5')
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
def test_fork_asyncio_subprocess(self):
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from test import support
from test.support import cpython_only, swap_attr
from test.support import async_yield, run_yielding_async_fn
from test.support import warnings_helper
from test.support.import_helper import import_module
from test.support.os_helper import (EnvironmentVarGuard, TESTFN, unlink)
from test.support.script_helper import assert_python_ok
Expand Down Expand Up @@ -2545,6 +2546,7 @@ def run_child(self, child, terminal_input):
finally:
signal.signal(signal.SIGHUP, old_sighup)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def _run_child(self, child, terminal_input):
r, w = os.pipe() # Pipe test results from child back to parent
try:
Expand Down
4 changes: 3 additions & 1 deletion Lib/test/test_fork1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from test.fork_wait import ForkWait
from test import support
from test.support import warnings_helper


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


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


@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_nested_import_lock_fork(self):
"""Check fork() in main thread works while the main thread is doing an import"""
exitcode = 42
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io
import tempfile
from test import support
from test.support import import_helper
from test.support import import_helper, warnings_helper
from test.support import os_helper
from test.support import refleak_helper
from test.support import socket_helper
Expand Down Expand Up @@ -1212,6 +1212,7 @@ def test_add_and_close(self):
self.assertEqual(contents, f.read())
self._box = self._factory(self._path)

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
@support.requires_fork()
@unittest.skipUnless(hasattr(socket, 'socketpair'), "Test needs socketpair().")
def test_lock_conflict(self):
Expand Down
4 changes: 3 additions & 1 deletion Lib/test/test_pty.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from test.support import (
is_android, is_apple_mobile, is_emscripten, is_wasi, reap_children, verbose
is_android, is_apple_mobile, is_emscripten, is_wasi, reap_children, verbose, warnings_helper
)
from test.support.import_helper import import_module
from test.support.os_helper import TESTFN, unlink
Expand Down Expand Up @@ -194,6 +194,7 @@ def test_openpty(self):
s2 = _readline(master_fd)
self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_fork(self):
debug("calling pty.fork()")
pid, master_fd = pty.fork()
Expand Down Expand Up @@ -295,6 +296,7 @@ def test_master_read(self):

self.assertEqual(data, b"")

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
def test_spawn_doesnt_hang(self):
self.addCleanup(unlink, TESTFN)
with open(TESTFN, 'wb') as f:
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from fractions import Fraction
from collections import abc, Counter

from test.support import warnings_helper


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

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
@test.support.requires_fork()
def test_after_fork(self):
# Test the global Random instance gets reseeded in child
Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ def test_check__all__(self):

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

@warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-135427
@unittest.skipUnless(hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG'),
'need os.waitpid() and os.WNOHANG')
@support.requires_fork()
Expand Down
Loading