diff options
author | Christian Heimes <christian@python.org> | 2022-03-10 12:43:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 12:43:40 (GMT) |
commit | de554d6e02228b840eb6bffaf7d406c0ef368d5f (patch) | |
tree | 8e9cb21338d5fa7b71a3940d6c62c501d0f547a8 /Lib/test/test_posix.py | |
parent | 8714b6fa27271035dd6dd3514e283f92d669321d (diff) | |
download | cpython-de554d6e02228b840eb6bffaf7d406c0ef368d5f.zip cpython-de554d6e02228b840eb6bffaf7d406c0ef368d5f.tar.gz cpython-de554d6e02228b840eb6bffaf7d406c0ef368d5f.tar.bz2 |
bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)
- fd inheritance can't be modified because Emscripten doesn't support subprocesses anyway.
- setpriority always fails
- geteuid no longer causes problems with latest emsdk
- umask is a stub
- geteuid / getuid always return 0, but process cannot chown to random uid.
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 395f065..c10039b 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -30,8 +30,11 @@ except ImportError: _DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(), os_helper.TESTFN + '-dummy-symlink') -requires_32b = unittest.skipUnless(sys.maxsize < 2**32, - 'test is only meaningful on 32-bit builds') +requires_32b = unittest.skipUnless( + # Emscripten has 32 bits pointers, but support 64 bits syscall args. + sys.maxsize < 2**32 and not support.is_emscripten, + 'test is only meaningful on 32-bit builds' +) def _supports_sched(): if not hasattr(posix, 'sched_getscheduler'): @@ -578,6 +581,7 @@ class PosixTester(unittest.TestCase): @unittest.skipUnless(hasattr(os, 'O_CLOEXEC'), "needs os.O_CLOEXEC") @support.requires_linux_version(2, 6, 23) + @support.requires_subprocess() def test_oscloexec(self): fd = os.open(os_helper.TESTFN, os.O_RDONLY|os.O_CLOEXEC) self.addCleanup(os.close, fd) @@ -737,7 +741,11 @@ class PosixTester(unittest.TestCase): is_root = (uid in (0, 1)) else: is_root = (uid == 0) - if is_root: + if support.is_emscripten: + # Emscripten getuid() / geteuid() always return 0 (root), but + # cannot chown uid/gid to random value. + pass + elif is_root: # Try an amusingly large uid/gid to make sure we handle # large unsigned values. (chown lets you use any # uid/gid you like, even if they aren't defined.) |