[3.11] gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) (GH-118739)

This commit is contained in:
Steve Dower 2024-05-24 01:13:18 +01:00 committed by GitHub
parent 4762b36540
commit 35c799d791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 103 additions and 2 deletions

View file

@ -1743,6 +1743,18 @@ class MakedirTests(unittest.TestCase):
self.assertRaises(OSError, os.makedirs, path, exist_ok=True)
os.remove(path)
@unittest.skipUnless(os.name == 'nt', "requires Windows")
def test_win32_mkdir_700(self):
base = os_helper.TESTFN
path = os.path.abspath(os.path.join(os_helper.TESTFN, 'dir'))
os.mkdir(path, mode=0o700)
out = subprocess.check_output(["cacls.exe", path, "/s"], encoding="oem")
os.rmdir(path)
self.assertEqual(
out.strip(),
f'{path} "D:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FA;;;OW)"',
)
def tearDown(self):
path = os.path.join(os_helper.TESTFN, 'dir1', 'dir2', 'dir3',
'dir4', 'dir5', 'dir6')