diff options
author | Christian Heimes <christian@python.org> | 2022-03-08 13:17:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 12:17:30 +0100 |
commit | 5081e78efde901556398615eb477c63c836686e5 (patch) | |
tree | 5be2667672a5d7a1df2b32b5a215546d1b5a5507 /Lib/test/test_genericpath.py | |
parent | 36dd7396fcd26d8bf9919d536d05d7000becbe5b (diff) | |
download | cpython-5081e78efde901556398615eb477c63c836686e5.tar.gz cpython-5081e78efde901556398615eb477c63c836686e5.zip |
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.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r-- | Lib/test/test_genericpath.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index 1ff7f75ad3e..2741adc139b 100644 --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -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 |