bpo-40648: Test modes that file can get with chmod() on Windows (GH-20130)

Order of tests matter second part makes testing file writable and
possible to remove again.
This commit is contained in:
Pavol Babinčák‏ 2023-12-13 21:23:13 +01:00 committed by GitHub
parent f14e3d59c9
commit f5c05e015c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -148,12 +148,19 @@ class TestFilemode:
self.assertEqual(modestr, '-r--r--r--')
self.assertEqual(self.statmod.S_IMODE(st_mode), 0o444)
else:
os.chmod(TESTFN, 0o500)
st_mode, modestr = self.get_mode()
self.assertEqual(modestr[:3], '-r-')
self.assertS_IS("REG", st_mode)
self.assertEqual(self.statmod.S_IMODE(st_mode), 0o444)
os.chmod(TESTFN, 0o700)
st_mode, modestr = self.get_mode()
self.assertEqual(modestr[:3], '-rw')
self.assertS_IS("REG", st_mode)
self.assertEqual(self.statmod.S_IFMT(st_mode),
self.statmod.S_IFREG)
self.assertEqual(self.statmod.S_IMODE(st_mode), 0o666)
@os_helper.skip_unless_working_chmod
def test_directory(self):

View File

@ -0,0 +1 @@
Test modes that file can get with chmod() on Windows.