mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-19930: The mode argument of os.makedirs() no longer affects the file (#799)
permission bits of newly-created intermediate-level directories.
This commit is contained in:
parent
5619ab2db3
commit
e304e33c16
5 changed files with 32 additions and 3 deletions
|
@ -1118,6 +1118,18 @@ class MakedirTests(unittest.TestCase):
|
|||
'dir5', 'dir6')
|
||||
os.makedirs(path)
|
||||
|
||||
def test_mode(self):
|
||||
with support.temp_umask(0o002):
|
||||
base = support.TESTFN
|
||||
parent = os.path.join(base, 'dir1')
|
||||
path = os.path.join(parent, 'dir2')
|
||||
os.makedirs(path, 0o555)
|
||||
self.assertTrue(os.path.exists(path))
|
||||
self.assertTrue(os.path.isdir(path))
|
||||
if os.name != 'nt':
|
||||
self.assertEqual(stat.S_IMODE(os.stat(path).st_mode), 0o555)
|
||||
self.assertEqual(stat.S_IMODE(os.stat(parent).st_mode), 0o775)
|
||||
|
||||
def test_exist_ok_existing_directory(self):
|
||||
path = os.path.join(support.TESTFN, 'dir1')
|
||||
mode = 0o777
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue