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
This commit is contained in:
Christian Heimes 2022-05-25 15:57:26 +02:00 committed by GitHub
parent 5e6e5b98a8
commit 1f134e96ba
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 @@ import unittest
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 @@ class _BasePathTest(object):
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('~')
@ -2508,7 +2509,8 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
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)
@ -2534,7 +2536,8 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
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)