diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-09-19 03:09:54 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-09-19 03:09:54 (GMT) |
commit | 5cc9a052c10662173677900b4ed010074716bc0a (patch) | |
tree | e77a186aa8c5ac094c5ac3d7e68f20c1b1a7ce1f /Lib/distutils | |
parent | eb19dce085de9723678acb8909b403a4c459c86a (diff) | |
download | cpython-5cc9a052c10662173677900b4ed010074716bc0a.zip cpython-5cc9a052c10662173677900b4ed010074716bc0a.tar.gz cpython-5cc9a052c10662173677900b4ed010074716bc0a.tar.bz2 |
Update the test_distutils mode test to test with umask value properly.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/tests/test_dir_util.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_dir_util.py b/Lib/distutils/tests/test_dir_util.py index 892a66d..a1647fb 100644 --- a/Lib/distutils/tests/test_dir_util.py +++ b/Lib/distutils/tests/test_dir_util.py @@ -53,10 +53,15 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase): @unittest.skipIf(sys.platform.startswith('win'), "This test is only appropriate for POSIX-like systems.") def test_mkpath_with_custom_mode(self): + # Get and set the current umask value for testing mode bits. + umask = os.umask(0o002) + os.umask(umask) mkpath(self.target, 0o700) - self.assertEqual(stat.S_IMODE(os.stat(self.target).st_mode), 0o700) + self.assertEqual( + stat.S_IMODE(os.stat(self.target).st_mode), 0o700 & ~umask) mkpath(self.target2, 0o555) - self.assertEqual(stat.S_IMODE(os.stat(self.target2).st_mode), 0o555) + self.assertEqual( + stat.S_IMODE(os.stat(self.target2).st_mode), 0o555 & ~umask) def test_create_tree_verbosity(self): |