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

@ -1765,6 +1765,7 @@ class RemoveDirsTests(unittest.TestCase):
self.assertTrue(os.path.exists(os_helper.TESTFN))
@unittest.skipIf(support.is_wasi, "WASI has no /dev/null")
class DevNullTests(unittest.TestCase):
def test_devnull(self):
with open(os.devnull, 'wb', 0) as f:
@ -2111,6 +2112,7 @@ class Win32ErrorTests(unittest.TestCase):
self.assertRaises(OSError, os.chmod, os_helper.TESTFN, 0)
@unittest.skipIf(support.is_wasi, "Cannot create invalid FD on WASI.")
class TestInvalidFD(unittest.TestCase):
singles = ["fchdir", "dup", "fdatasync", "fstat",
"fstatvfs", "fsync", "tcgetpgrp", "ttyname"]