]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] bpo-40648: Test modes that file can get with chmod() on Windows (GH-20130...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 13 Dec 2023 20:50:50 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Dec 2023 20:50:50 +0000 (20:50 +0000)
Order of tests matter second part makes testing file writable and
possible to remove again.
(cherry picked from commit f5c05e015c178975f24b77e5a8975a22d694e019)

Co-authored-by: Pavol Babinčák‏ <scroolik@gmail.com>
Lib/test/test_stat.py
Misc/NEWS.d/next/Tests/2020-05-16-18-00-21.bpo-40648.p2uPqy.rst [new file with mode: 0644]

index 4ba37aed2dc9db3469f618538c94b9da355a4b15..c77fec3d39d61efcfb696568780081f7f2757c63 100644 (file)
@@ -145,12 +145,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):
diff --git a/Misc/NEWS.d/next/Tests/2020-05-16-18-00-21.bpo-40648.p2uPqy.rst b/Misc/NEWS.d/next/Tests/2020-05-16-18-00-21.bpo-40648.p2uPqy.rst
new file mode 100644 (file)
index 0000000..8fbe42d
--- /dev/null
@@ -0,0 +1 @@
+Test modes that file can get with chmod() on Windows.