gh-90473: Misc test fixes for WASI (GH-93218)

* ``sys.executable`` is not set
* WASI does not support subprocess
* ``pwd`` module is not available
* WASI checks ``open`` syscall flags more strict, needs r, w, rw flag.
* ``umask`` is not available
* ``/dev/null`` may not be accessible
(cherry picked from commit 1f134e96ba)

Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
Miss Islington (bot) 2022-05-25 07:24:32 -07:00 committed by GitHub
parent 307dacd651
commit 0fb70ce191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 7 deletions

View file

@ -13,7 +13,7 @@
from unittest import mock
from test.support import import_helper
from test.support import is_emscripten
from test.support import is_emscripten, is_wasi
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
@ -1530,6 +1530,7 @@ def test_empty_path(self):
p = self.cls('')
self.assertEqual(p.stat(), os.stat('.'))
@unittest.skipIf(is_wasi, "WASI has no user accounts.")
def test_expanduser_common(self):
P = self.cls
p = P('~')
@ -2530,7 +2531,8 @@ def _check_symlink_loop(self, *args, strict=True):
print(path.resolve(strict))
@unittest.skipIf(
is_emscripten, "umask is not implemented on Emscripten."
is_emscripten or is_wasi,
"umask is not implemented on Emscripten/WASI."
)
def test_open_mode(self):
old_mask = os.umask(0)
@ -2556,7 +2558,8 @@ def test_resolve_root(self):
os.chdir(current_directory)
@unittest.skipIf(
is_emscripten, "umask is not implemented on Emscripten."
is_emscripten or is_wasi,
"umask is not implemented on Emscripten/WASI."
)
def test_touch_mode(self):
old_mask = os.umask(0)