mirror of https://github.com/python/cpython
[3.11] gh-90473: Skip POSIX tests that don't apply to WASI (GH-93536) (GH-93540)
(cherry picked from commit 80a39daecd
)
Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
f46e30f9d4
commit
986ce4e613
|
@ -31,8 +31,8 @@ _DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
|
||||||
os_helper.TESTFN + '-dummy-symlink')
|
os_helper.TESTFN + '-dummy-symlink')
|
||||||
|
|
||||||
requires_32b = unittest.skipUnless(
|
requires_32b = unittest.skipUnless(
|
||||||
# Emscripten has 32 bits pointers, but support 64 bits syscall args.
|
# Emscripten/WASI have 32 bits pointers, but support 64 bits syscall args.
|
||||||
sys.maxsize < 2**32 and not support.is_emscripten,
|
sys.maxsize < 2**32 and not (support.is_emscripten or support.is_wasi),
|
||||||
'test is only meaningful on 32-bit builds'
|
'test is only meaningful on 32-bit builds'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -547,6 +547,7 @@ class PosixTester(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(posix, 'dup'),
|
@unittest.skipUnless(hasattr(posix, 'dup'),
|
||||||
'test needs posix.dup()')
|
'test needs posix.dup()')
|
||||||
|
@unittest.skipIf(support.is_wasi, "WASI does not have dup()")
|
||||||
def test_dup(self):
|
def test_dup(self):
|
||||||
fp = open(os_helper.TESTFN)
|
fp = open(os_helper.TESTFN)
|
||||||
try:
|
try:
|
||||||
|
@ -564,6 +565,7 @@ class PosixTester(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(posix, 'dup2'),
|
@unittest.skipUnless(hasattr(posix, 'dup2'),
|
||||||
'test needs posix.dup2()')
|
'test needs posix.dup2()')
|
||||||
|
@unittest.skipIf(support.is_wasi, "WASI does not have dup2()")
|
||||||
def test_dup2(self):
|
def test_dup2(self):
|
||||||
fp1 = open(os_helper.TESTFN)
|
fp1 = open(os_helper.TESTFN)
|
||||||
fp2 = open(os_helper.TESTFN)
|
fp2 = open(os_helper.TESTFN)
|
||||||
|
@ -1212,6 +1214,7 @@ class PosixTester(unittest.TestCase):
|
||||||
# bpo-47205: does not raise OSError on FreeBSD
|
# bpo-47205: does not raise OSError on FreeBSD
|
||||||
self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)
|
self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)
|
||||||
|
|
||||||
|
@unittest.skipIf(support.is_wasi, "No dynamic linking on WASI")
|
||||||
def test_rtld_constants(self):
|
def test_rtld_constants(self):
|
||||||
# check presence of major RTLD_* constants
|
# check presence of major RTLD_* constants
|
||||||
posix.RTLD_LAZY
|
posix.RTLD_LAZY
|
||||||
|
@ -1406,6 +1409,10 @@ class TestPosixDirFd(unittest.TestCase):
|
||||||
# whoops! using both together not supported on this platform.
|
# whoops! using both together not supported on this platform.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@unittest.skipIf(
|
||||||
|
support.is_wasi,
|
||||||
|
"WASI: symlink following on path_link is not supported"
|
||||||
|
)
|
||||||
@unittest.skipUnless(
|
@unittest.skipUnless(
|
||||||
hasattr(os, "link") and os.link in os.supports_dir_fd,
|
hasattr(os, "link") and os.link in os.supports_dir_fd,
|
||||||
"test needs dir_fd support in os.link()"
|
"test needs dir_fd support in os.link()"
|
||||||
|
|
Loading…
Reference in New Issue