Skip to content

Commit

Permalink
bpo-40648: Test modes that file can get with chmod() on Windows (pyth…
Browse files Browse the repository at this point in the history
…onGH-20130)

Order of tests matter second part makes testing file writable and
possible to remove again.
  • Loading branch information
scrool authored Dec 13, 2023
1 parent f14e3d5 commit f5c05e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Lib/test/test_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,19 @@ def test_mode(self):
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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test modes that file can get with chmod() on Windows.

0 comments on commit f5c05e0

Please sign in to comment.