gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534)

WASI does not have the ``chmod(2)`` syscall yet.
This commit is contained in:
Christian Heimes 2022-06-06 19:24:11 +02:00 committed by GitHub
parent 56b5daf159
commit 22fed605e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 81 additions and 5 deletions

View file

@ -74,6 +74,7 @@ class UUTest(unittest.TestCase):
with self.assertRaises(TypeError):
uu.encode(inp, out, "t1", 0o644, True)
@os_helper.skip_unless_working_chmod
def test_decode(self):
for backtick in True, False:
inp = io.BytesIO(encodedtextwrapped(0o666, "t1", backtick=backtick))
@ -199,6 +200,8 @@ class UUFileTest(unittest.TestCase):
s = fout.read()
self.assertEqual(s, encodedtextwrapped(0o644, self.tmpin))
# decode() calls chmod()
@os_helper.skip_unless_working_chmod
def test_decode(self):
with open(self.tmpin, 'wb') as f:
f.write(encodedtextwrapped(0o644, self.tmpout))
@ -211,6 +214,7 @@ class UUFileTest(unittest.TestCase):
self.assertEqual(s, plaintext)
# XXX is there an xp way to verify the mode?
@os_helper.skip_unless_working_chmod
def test_decode_filename(self):
with open(self.tmpin, 'wb') as f:
f.write(encodedtextwrapped(0o644, self.tmpout))
@ -221,6 +225,7 @@ class UUFileTest(unittest.TestCase):
s = f.read()
self.assertEqual(s, plaintext)
@os_helper.skip_unless_working_chmod
def test_decodetwice(self):
# Verify that decode() will refuse to overwrite an existing file
with open(self.tmpin, 'wb') as f:
@ -231,6 +236,7 @@ class UUFileTest(unittest.TestCase):
with open(self.tmpin, 'rb') as f:
self.assertRaises(uu.Error, uu.decode, f)
@os_helper.skip_unless_working_chmod
def test_decode_mode(self):
# Verify that decode() will set the given mode for the out_file
expected_mode = 0o444