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

Order of tests matter second part makes testing file writable and
possible to remove again.
This commit is contained in:
Pavol Babinčák 2020-05-16 17:50:50 +02:00
parent 1b97b9b0ad
commit 67c15302b0
2 changed files with 8 additions and 0 deletions

View File

@ -141,12 +141,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)
def test_directory(self):
os.mkdir(TESTFN)

View File

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