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

@ -1,6 +1,11 @@
import netrc, os, unittest, sys, textwrap
from test.support import os_helper, run_unittest
try:
import pwd
except ImportError:
pwd = None
temp_filename = os_helper.TESTFN
class NetrcTestCase(unittest.TestCase):
@ -266,6 +271,7 @@ class NetrcTestCase(unittest.TestCase):
@unittest.skipUnless(os.name == 'posix', 'POSIX only test')
@unittest.skipIf(pwd is None, 'security check requires pwd module')
def test_security(self):
# This test is incomplete since we are normally not run as root and
# therefore can't test the file ownership being wrong.