mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40280: Block more non-working syscalls in Emscripten (GH-31757)
- getgroups always fails. - geteuid and getegid always return 0 (root), which confuse tarfile and tests. - hardlinks (link, linkat) always fails. - non-encodable file names are not supported by NODERAWFS layer. - mark more tests with dependency on subprocess and multiprocessing. Mocking does not work if the module fails to import.
This commit is contained in:
parent
36dd7396fc
commit
5081e78efd
8 changed files with 37 additions and 10 deletions
|
@ -7,6 +7,7 @@ import os
|
|||
import sys
|
||||
import unittest
|
||||
import warnings
|
||||
from test.support import is_emscripten
|
||||
from test.support import os_helper
|
||||
from test.support import warnings_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
@ -154,6 +155,7 @@ class GenericTest:
|
|||
self.assertIs(self.pathmodule.lexists(bfilename + b'\x00'), False)
|
||||
|
||||
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
|
||||
@unittest.skipIf(is_emscripten, "Emscripten pipe fds have no stat")
|
||||
def test_exists_fd(self):
|
||||
r, w = os.pipe()
|
||||
try:
|
||||
|
@ -246,6 +248,7 @@ class GenericTest:
|
|||
def test_samefile_on_symlink(self):
|
||||
self._test_samefile_on_link_func(os.symlink)
|
||||
|
||||
@unittest.skipUnless(hasattr(os, 'link'), 'requires os.link')
|
||||
def test_samefile_on_link(self):
|
||||
try:
|
||||
self._test_samefile_on_link_func(os.link)
|
||||
|
@ -288,6 +291,7 @@ class GenericTest:
|
|||
def test_samestat_on_symlink(self):
|
||||
self._test_samestat_on_link_func(os.symlink)
|
||||
|
||||
@unittest.skipUnless(hasattr(os, 'link'), 'requires os.link')
|
||||
def test_samestat_on_link(self):
|
||||
try:
|
||||
self._test_samestat_on_link_func(os.link)
|
||||
|
@ -476,11 +480,11 @@ class CommonTest(GenericTest):
|
|||
|
||||
def test_nonascii_abspath(self):
|
||||
if (os_helper.TESTFN_UNDECODABLE
|
||||
# Mac OS X denies the creation of a directory with an invalid
|
||||
# UTF-8 name. Windows allows creating a directory with an
|
||||
# macOS and Emscripten deny the creation of a directory with an
|
||||
# invalid UTF-8 name. Windows allows creating a directory with an
|
||||
# arbitrary bytes name, but fails to enter this directory
|
||||
# (when the bytes name is used).
|
||||
and sys.platform not in ('win32', 'darwin')):
|
||||
and sys.platform not in ('win32', 'darwin', 'emscripten')):
|
||||
name = os_helper.TESTFN_UNDECODABLE
|
||||
elif os_helper.TESTFN_NONASCII:
|
||||
name = os_helper.TESTFN_NONASCII
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue