Commit fdc07fb4 authored by Senthil Kumaran's avatar Senthil Kumaran

Fix Issue2236: Distutils' mkpath implementation ignoring the "mode" parameter

parent c9bc9d98
......@@ -68,7 +68,7 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):
if not dry_run:
try:
os.mkdir(head)
os.mkdir(head, mode)
created_dirs.append(head)
except OSError as exc:
raise DistutilsFileError(
......
"""Tests for distutils.dir_util."""
import unittest
import os
import stat
import shutil
from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree,
......@@ -48,6 +49,12 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
wanted = ["removing '%s' (and everything under it)" % self.root_target]
self.assertEquals(self._logs, wanted)
def test_mkpath_with_custom_mode(self):
mkpath(self.target, 0o700)
self.assertEqual(stat.S_IMODE(os.stat(self.target).st_mode), 0o700)
mkpath(self.target2, 0o555)
self.assertEqual(stat.S_IMODE(os.stat(self.target2).st_mode), 0o555)
def test_create_tree_verbosity(self):
create_tree(self.root_target, ['one', 'two', 'three'], verbose=0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment