Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c5ff3f5
add support for os fork
Apr 15, 2023
c2dd77d
WIP: add stub functions for registring callbacks
Apr 16, 2023
bd25a54
fill stubs
Apr 16, 2023
2efe9bd
make things functional
Apr 16, 2023
3ee4da8
make args as kwargs for register at fork
Apr 16, 2023
c6da379
change error text as per as cpython
Apr 16, 2023
d51daaf
add skip test for os.fork on windows
Apr 17, 2023
9fc8952
chore! fix clippy errors
Apr 17, 2023
137fd29
skip fork functions in windows
Apr 17, 2023
f98c005
Merge branch 'main' of github.com:itsankitkp/RustPython into add-fork…
Apr 17, 2023
a58e429
skip unsupported function calls
Apr 17, 2023
cb5166f
remove un-needed skip decorators
Apr 17, 2023
ddcae23
Update Lib/test/test_socketserver.py
itsankitkp Apr 17, 2023
63a881c
remove un-needed decorator
Apr 17, 2023
abce797
fix lint
Apr 17, 2023
7aa1311
add todo items
Apr 17, 2023
5779c89
remove un-needed comment
Apr 17, 2023
37b73f3
fix test case getting stuck
Apr 18, 2023
eaa3e63
Update Lib/test/test_httpservers.py
itsankitkp Apr 18, 2023
e041cbd
fix test case getting stuck
itsankitkp Apr 18, 2023
ae634d2
skip failures due to missing module
itsankitkp Apr 19, 2023
e0a2228
Merge branch 'add-fork-in-os' of github.com:itsankitkp/RustPython int…
itsankitkp Apr 19, 2023
f54f715
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
e27e9e9
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
6199f76
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
9ebdf0b
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
9c525af
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
84fda43
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
8918617
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
123bc2d
Update Lib/test/test_threading.py
itsankitkp Apr 20, 2023
844365e
Merge branch 'main' of github.com:itsankitkp/RustPython into add-fork…
itsankitkp Apr 22, 2023
d69426b
Merge branch 'main' of github.com:itsankitkp/RustPython into add-fork…
itsankitkp Apr 23, 2023
20f5abf
skip cases which needs _at_fork_reinit support
itsankitkp Apr 23, 2023
3bfe8c8
add type error if arg is not callable
itsankitkp Apr 23, 2023
e2e6844
reverse function calls for before forkers as per as cpython implement…
itsankitkp Apr 23, 2023
e5d9bb5
handle non callable args
itsankitkp Apr 23, 2023
0fd1a9f
skip test cases which has dependencies on Lock._at_fork_reinit
itsankitkp Apr 23, 2023
47f13b2
skip test case
itsankitkp Apr 23, 2023
35f23be
remove un-needed expected failure decorator as test is passing
itsankitkp Apr 23, 2023
e19c8fd
debug test failure
itsankitkp Apr 23, 2023
c79e2fd
increase verbosity
itsankitkp Apr 23, 2023
f237e5e
print more lines for debug
itsankitkp Apr 23, 2023
870ef53
disable assertion failure to check error
itsankitkp Apr 23, 2023
fdaefd0
more debugging
itsankitkp Apr 23, 2023
eb01160
minor change
itsankitkp Apr 23, 2023
669ff59
add logs
itsankitkp Apr 23, 2023
76b89ce
more experimentations to get error
itsankitkp Apr 23, 2023
68a78e4
last shot to find issue
itsankitkp Apr 23, 2023
a854bb6
remove debug logs
itsankitkp Apr 23, 2023
110fc33
skip test_input_no_stdout_fileno for macos
youknowone Apr 23, 2023
0a2c6fd
Add todo item
itsankitkp Apr 23, 2023
af28311
Add todo item
itsankitkp Apr 23, 2023
dc087c3
not to remove it when update to next CPython version
itsankitkp Apr 23, 2023
511a448
add todo item
itsankitkp Apr 23, 2023
e4aacf9
handle optional args for register at fork
itsankitkp Apr 23, 2023
72b53a9
add ignore kwargs
itsankitkp Apr 23, 2023
f8b966d
remove clone
itsankitkp Apr 23, 2023
9963280
chore! add ignorable kwargs
itsankitkp Apr 23, 2023
6cd534b
add cfg to unix only structs
itsankitkp Apr 23, 2023
0b8f237
Update Lib/test/test_pty.py
itsankitkp Apr 24, 2023
a85ac15
Update vm/src/stdlib/os.rs
itsankitkp Apr 24, 2023
68fc959
use cleaner way of param validation and remove take on state
itsankitkp Apr 24, 2023
90b472b
add skip cfg
itsankitkp Apr 24, 2023
7b52282
Update Lib/test/test_os.py
itsankitkp Apr 24, 2023
898e084
Update Lib/test/test_fcntl.py
youknowone Apr 24, 2023
5ab1706
relocate fork to posix
youknowone Apr 24, 2023
0b61077
simplify fork functoins
youknowone Apr 24, 2023
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
3 changes: 2 additions & 1 deletion Lib/concurrent/futures/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def _python_exit():
threading._register_atexit(_python_exit)

# At fork, reinitialize the `_global_shutdown_lock` lock in the child process
if hasattr(os, 'register_at_fork'):
# TODO RUSTPYTHON - _at_fork_reinit is not implemented yet
if hasattr(os, 'register_at_fork') and hasattr(_global_shutdown_lock, '_at_fork_reinit'):
os.register_at_fork(before=_global_shutdown_lock.acquire,
after_in_child=_global_shutdown_lock._at_fork_reinit,
after_in_parent=_global_shutdown_lock.release)
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
except ImportError:
pty = signal = None

import threading # XXX: RUSTPYTHON; to skip _at_fork_reinit


class Squares:

Expand Down Expand Up @@ -2269,6 +2271,7 @@ def test_input_tty_non_ascii_unicode_errors(self):
# Check stdin/stdout error handler is used when invoking PyOS_Readline()
self.check_input_tty("prompté", b"quux\xe9", "ascii")

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_input_no_stdout_fileno(self):
# Issue #24402: If stdin is the original terminal but stdout.fileno()
# fails, do not use the original stdout file descriptor
Expand Down
8 changes: 5 additions & 3 deletions Lib/test/test_fcntl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import struct
import sys
import threading # XXX: RUSTPYTHON
import unittest
from multiprocessing import Process
from test.support import verbose, cpython_only
Expand Down Expand Up @@ -155,8 +156,9 @@ def test_flock(self):
self.assertRaises(ValueError, fcntl.flock, -1, fcntl.LOCK_SH)
self.assertRaises(TypeError, fcntl.flock, 'spam', fcntl.LOCK_SH)

# TODO: RUSTPYTHON, AttributeError: module 'os' has no attribute 'fork'
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.skipIf(platform.system() == "AIX", "AIX returns PermissionError")
def test_lockf_exclusive(self):
self.f = open(TESTFN, 'wb+')
Expand All @@ -167,9 +169,9 @@ def test_lockf_exclusive(self):
p.join()
fcntl.lockf(self.f, fcntl.LOCK_UN)
self.assertEqual(p.exitcode, 0)

# TODO: RUSTPYTHON, AttributeError: module 'os' has no attribute 'fork'
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.skipIf(platform.system() == "AIX", "AIX returns PermissionError")
def test_lockf_share(self):
self.f = open(TESTFN, 'wb+')
Expand Down
14 changes: 13 additions & 1 deletion Lib/test/test_httpservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ def test_html_escape_filename(self):
print("</pre>")
"""


@unittest.skipIf(not hasattr(os, '_exit'),
"TODO: RUSTPYTHON, run_cgi in http/server.py gets stuck as os._exit(127) doesn't currently kill forked processes")
@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
"This test can't be run reliably as root (issue #13308).")
class CGIHTTPServerTestCase(BaseTestCase):
Expand Down Expand Up @@ -765,6 +766,7 @@ def test_url_collapse_path(self):
msg='path = %r\nGot: %r\nWanted: %r' %
(path, actual, expected))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_headers_and_content(self):
res = self.request('/cgi-bin/file1.py')
self.assertEqual(
Expand All @@ -775,6 +777,7 @@ def test_issue19435(self):
res = self.request('///////////nocgi.py/../cgi-bin/nothere.sh')
self.assertEqual(res.status, HTTPStatus.NOT_FOUND)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_post(self):
params = urllib.parse.urlencode(
{'spam' : 1, 'eggs' : 'python', 'bacon' : 123456})
Expand All @@ -788,6 +791,7 @@ def test_invaliduri(self):
res.read()
self.assertEqual(res.status, HTTPStatus.NOT_FOUND)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_authorization(self):
headers = {b'Authorization' : b'Basic ' +
base64.b64encode(b'username:pass')}
Expand All @@ -796,13 +800,15 @@ def test_authorization(self):
(b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_no_leading_slash(self):
# http://bugs.python.org/issue2254
res = self.request('cgi-bin/file1.py')
self.assertEqual(
(b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_os_environ_is_not_altered(self):
signature = "Test CGI Server"
os.environ['SERVER_SOFTWARE'] = signature
Expand All @@ -812,31 +818,36 @@ def test_os_environ_is_not_altered(self):
(res.read(), res.getheader('Content-type'), res.status))
self.assertEqual(os.environ['SERVER_SOFTWARE'], signature)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_urlquote_decoding_in_cgi_check(self):
res = self.request('/cgi-bin%2ffile1.py')
self.assertEqual(
(b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_nested_cgi_path_issue21323(self):
res = self.request('/cgi-bin/child-dir/file3.py')
self.assertEqual(
(b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_query_with_multiple_question_mark(self):
res = self.request('/cgi-bin/file4.py?a=b?c=d')
self.assertEqual(
(b'a=b?c=d' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_query_with_continuous_slashes(self):
res = self.request('/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//')
self.assertEqual(
(b'k=aa%2F%2Fbb&//q//p//=//a//b//' + self.linesep,
'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_cgi_path_in_sub_directories(self):
try:
CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin')
Expand All @@ -847,6 +858,7 @@ def test_cgi_path_in_sub_directories(self):
finally:
CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin')

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
def test_accept(self):
browser_accept = \
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
Expand Down
52 changes: 50 additions & 2 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
except ImportError:
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize

try:
import _testcapi
except ImportError:
_testcapi = None

from test.support.script_helper import assert_python_ok
from test.support import unix_shell
Expand Down Expand Up @@ -3067,11 +3071,13 @@ def check_waitpid(self, code, exitcode, callback=None):
self.assertEqual(pid2, pid)

# TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv')
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.expectedFailure
def test_waitpid(self):
self.check_waitpid(code='pass', exitcode=0)

# TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv')
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.expectedFailure
def test_waitstatus_to_exitcode(self):
exitcode = 23
Expand Down Expand Up @@ -3103,7 +3109,8 @@ def test_waitstatus_to_exitcode_windows(self):
os.waitstatus_to_exitcode((max_exitcode + 1) << 8)
with self.assertRaises(OverflowError):
os.waitstatus_to_exitcode(-1)


@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
# TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv')
@unittest.expectedFailure
# Skip the test on Windows
Expand Down Expand Up @@ -3146,31 +3153,36 @@ def create_args(self, *, with_env=False, use_bytes=False):
for k, v in self.env.items()}

return args


@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnl')
def test_spawnl(self):
args = self.create_args()
exitcode = os.spawnl(os.P_WAIT, args[0], *args)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnle')
def test_spawnle(self):
args = self.create_args(with_env=True)
exitcode = os.spawnle(os.P_WAIT, args[0], *args, self.env)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnlp')
def test_spawnlp(self):
args = self.create_args()
exitcode = os.spawnlp(os.P_WAIT, args[0], *args)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnlpe')
def test_spawnlpe(self):
args = self.create_args(with_env=True)
exitcode = os.spawnlpe(os.P_WAIT, args[0], *args, self.env)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnv')
def test_spawnv(self):
args = self.create_args()
Expand All @@ -3181,30 +3193,35 @@ def test_spawnv(self):
exitcode = os.spawnv(os.P_WAIT, FakePath(args[0]), args)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnve')
def test_spawnve(self):
args = self.create_args(with_env=True)
exitcode = os.spawnve(os.P_WAIT, args[0], args, self.env)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnvp')
def test_spawnvp(self):
args = self.create_args()
exitcode = os.spawnvp(os.P_WAIT, args[0], args)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnvpe')
def test_spawnvpe(self):
args = self.create_args(with_env=True)
exitcode = os.spawnvpe(os.P_WAIT, args[0], args, self.env)
self.assertEqual(exitcode, self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnv')
def test_nowait(self):
args = self.create_args()
pid = os.spawnv(os.P_NOWAIT, args[0], args)
support.wait_process(pid, exitcode=self.exitcode)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnve')
def test_spawnve_bytes(self):
# Test bytes handling in parse_arglist and parse_envlist (#28114)
Expand Down Expand Up @@ -3286,10 +3303,12 @@ def _test_invalid_env(self, spawn):
exitcode = spawn(os.P_WAIT, args[0], args, newenv)
self.assertEqual(exitcode, 0)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnve')
def test_spawnve_invalid_env(self):
self._test_invalid_env(os.spawnve)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@requires_os_func('spawnvpe')
def test_spawnvpe_invalid_env(self):
self._test_invalid_env(os.spawnvpe)
Expand Down Expand Up @@ -4660,6 +4679,35 @@ def test_fork(self):
assert_python_ok("-c", code)
assert_python_ok("-c", code, PYTHONMALLOC="malloc_debug")

@unittest.skipIf(_testcapi is None, 'TODO: RUSTPYTHON; needs _testcapi')
@unittest.skipUnless(sys.platform in ("linux", "darwin"),
"Only Linux and macOS detect this today.")
def test_fork_warns_when_non_python_thread_exists(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this originated from CPython source code?

Copy link
Contributor Author

@itsankitkp itsankitkp Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

    @unittest.skipUnless(sys.platform in ("linux", "darwin"),
                         "Only Linux and macOS detect this today.")
    def test_fork_warns_when_non_python_thread_exists(self):
       ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it. it came from later then 3.11.

code = """if 1:
import os, threading, warnings
from _testcapi import _spawn_pthread_waiter, _end_spawned_pthread
_spawn_pthread_waiter()
try:
with warnings.catch_warnings(record=True) as ws:
warnings.filterwarnings(
"always", category=DeprecationWarning)
if os.fork() == 0:
assert not ws, f"unexpected warnings in child: {ws}"
os._exit(0) # child
else:
assert ws[0].category == DeprecationWarning, ws[0]
assert 'fork' in str(ws[0].message), ws[0]
# Waiting allows an error in the child to hit stderr.
exitcode = os.wait()[1]
assert exitcode == 0, f"child exited {exitcode}"
assert threading.active_count() == 1, threading.enumerate()
finally:
_end_spawned_pthread()
"""
_, out, err = assert_python_ok("-c", code, PYTHONOPTIMIZE='0')
self.assertEqual(err.decode("utf-8"), "")
self.assertEqual(out.decode("utf-8"), "")


# Only test if the C version is provided, otherwise TestPEP519 already tested
# the pure Python implementation.
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ def test_mac_ver(self):
else:
self.assertEqual(res[2], 'PowerPC')

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipUnless(sys.platform == 'darwin', "OSX only test")
def test_mac_ver_with_fork(self):
# Issue7895: platform.mac_ver() crashes when using fork without exec
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_pty.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import threading # XXX: RUSTPYTHON
from test.support import verbose, reap_children
from test.support.import_helper import import_module

Expand Down Expand Up @@ -211,6 +212,7 @@ def test_openpty(self):
self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))

# TODO: RUSTPYTHON
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.expectedFailure
def test_fork(self):
debug("calling pty.fork()")
Expand Down Expand Up @@ -314,6 +316,7 @@ def test_master_read(self):
self.assertEqual(data, b"")

# TODO: RUSTPYTHON; no os.fork
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.expectedFailure
def test_spawn_doesnt_hang(self):
pty.spawn([sys.executable, '-c', 'print("hi there")'])
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_socketserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ForkingUnixDatagramServer(socketserver.ForkingMixIn,
socketserver.UnixDatagramServer):
pass


@test.support.requires_fork() # TODO: RUSTPYTHON, os.fork is currently only supported on Unix-based systems
@contextlib.contextmanager
def simple_subprocess(testcase):
"""Tests that a custom child process is not waited on (Issue 1540386)"""
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import tempfile
import textwrap
import threading # XXX: RUSTPYTHON
import time
import unittest
import warnings
Expand Down Expand Up @@ -453,6 +454,7 @@ def test_check__all__(self):

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.skipUnless(hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG'),
'need os.waitpid() and os.WNOHANG')
@support.requires_fork()
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pathlib
import sys
import re
import threading # XXX: RUSTPYTHON; to check `_at_fork_reinit`
import warnings
import contextlib
import stat
Expand Down Expand Up @@ -198,6 +199,7 @@ def supports_iter(self):
if i == 20:
break

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.skipUnless(hasattr(os, 'fork'),
"os.fork is required for this test")
def test_process_awareness(self):
Expand Down Expand Up @@ -465,6 +467,7 @@ def test_file_mode(self):
expected = user * (1 + 8 + 64)
self.assertEqual(mode, expected)

@unittest.skipUnless(hasattr(threading.Lock(), '_at_fork_reinit'), 'TODO: RUSTPYTHON, test needs lock._at_fork_reinit')
@unittest.skipUnless(has_spawnl, 'os.spawnl not available')
def test_noinherit(self):
# _mkstemp_inner file handles are not inherited by child processes
Expand Down
Loading