diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-15 11:21:27 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-15 11:21:27 (GMT) |
| commit | e1dfa978b1ad210d551385ad8073ec6154f53763 (patch) | |
| tree | 0730fba257daaeb10077529f74e7efaf04c26b87 /Lib/test | |
| parent | dd8a61f901d300beeb2f1875a5efe993d09e01e2 (diff) | |
| download | cpython-e1dfa978b1ad210d551385ad8073ec6154f53763.zip cpython-e1dfa978b1ad210d551385ad8073ec6154f53763.tar.gz cpython-e1dfa978b1ad210d551385ad8073ec6154f53763.tar.bz2 | |
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL (GH-119056)
(cherry picked from commit 94591dca510c796c7d40e9b4167ea56f2fdf28ca)
Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_os.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 9088318..941fa2b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1814,21 +1814,14 @@ class MakedirTests(unittest.TestCase): @unittest.skipUnless(os.name == 'nt', "requires Windows") def test_win32_mkdir_700(self): base = os_helper.TESTFN - path1 = os.path.join(os_helper.TESTFN, 'dir1') - path2 = os.path.join(os_helper.TESTFN, 'dir2') - # mode=0o700 is special-cased to override ACLs on Windows - # There's no way to know exactly how the ACLs will look, so we'll - # check that they are different from a regularly created directory. - os.mkdir(path1, mode=0o700) - os.mkdir(path2, mode=0o777) - - out1 = subprocess.check_output(["icacls.exe", path1], encoding="oem") - out2 = subprocess.check_output(["icacls.exe", path2], encoding="oem") - os.rmdir(path1) - os.rmdir(path2) - out1 = out1.replace(path1, "<PATH>") - out2 = out2.replace(path2, "<PATH>") - self.assertNotEqual(out1, out2) + 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', |
