Skip to content

Commit

Permalink
pythongh-90473: Skip POSIX tests that don't apply to WASI (pythonGH-9…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran committed Jun 6, 2022
1 parent 86a5e22 commit 80a39da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
os_helper.TESTFN + '-dummy-symlink')

requires_32b = unittest.skipUnless(
# Emscripten has 32 bits pointers, but support 64 bits syscall args.
sys.maxsize < 2**32 and not support.is_emscripten,
# Emscripten/WASI have 32 bits pointers, but support 64 bits syscall args.
sys.maxsize < 2**32 and not (support.is_emscripten or support.is_wasi),
'test is only meaningful on 32-bit builds'
)

Expand Down Expand Up @@ -547,6 +547,7 @@ def test_readv_overflow_32bits(self):

@unittest.skipUnless(hasattr(posix, 'dup'),
'test needs posix.dup()')
@unittest.skipIf(support.is_wasi, "WASI does not have dup()")
def test_dup(self):
fp = open(os_helper.TESTFN)
try:
Expand All @@ -564,6 +565,7 @@ def test_confstr(self):

@unittest.skipUnless(hasattr(posix, 'dup2'),
'test needs posix.dup2()')
@unittest.skipIf(support.is_wasi, "WASI does not have dup2()")
def test_dup2(self):
fp1 = open(os_helper.TESTFN)
fp2 = open(os_helper.TESTFN)
Expand Down Expand Up @@ -1212,6 +1214,7 @@ def test_sched_setaffinity(self):
# bpo-47205: does not raise OSError on FreeBSD
self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)

@unittest.skipIf(support.is_wasi, "No dynamic linking on WASI")
def test_rtld_constants(self):
# check presence of major RTLD_* constants
posix.RTLD_LAZY
Expand Down Expand Up @@ -1406,6 +1409,10 @@ def test_utime_dir_fd(self):
# whoops! using both together not supported on this platform.
pass

@unittest.skipIf(
support.is_wasi,
"WASI: symlink following on path_link is not supported"
)
@unittest.skipUnless(
hasattr(os, "link") and os.link in os.supports_dir_fd,
"test needs dir_fd support in os.link()"
Expand Down

0 comments on commit 80a39da

Please sign in to comment.