diff options
author | Charles-François Natali <neologix@free.fr> | 2011-11-10 18:12:29 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-11-10 18:12:29 (GMT) |
commit | 0c929d9d397c2a2578a2b016ae9b3d258ab513aa (patch) | |
tree | ffd2b8398314f5c52ecb0ce7052351bf57a82d0b /Lib/test/test_import.py | |
parent | 1db7c13be1cbf29af66306b471bc826dadb8efa4 (diff) | |
download | cpython-0c929d9d397c2a2578a2b016ae9b3d258ab513aa.zip cpython-0c929d9d397c2a2578a2b016ae9b3d258ab513aa.tar.gz cpython-0c929d9d397c2a2578a2b016ae9b3d258ab513aa.tar.bz2 |
Issue #13303: Fix bytecode file default permission.
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 338f1d4..86ef40e 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -97,25 +97,22 @@ class ImportTests(unittest.TestCase): @unittest.skipUnless(os.name == 'posix', "test meaningful only on posix systems") - def test_execute_bit_not_copied(self): - # Issue 6070: under posix .pyc files got their execute bit set if - # the .py file had the execute bit set, but they aren't executable. - with temp_umask(0o022): + def test_creation_mode(self): + mask = 0o022 + with temp_umask(mask): sys.path.insert(0, os.curdir) try: fname = TESTFN + os.extsep + "py" create_empty_file(fname) - os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | - stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)) __import__(TESTFN) fn = imp.cache_from_source(fname) if not os.path.exists(fn): self.fail("__import__ did not result in creation of " "either a .pyc or .pyo file") - s = os.stat(fn) - self.assertEqual( - stat.S_IMODE(s.st_mode), - stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) + s = os.stat(fn) + # Check that the umask is respected, and the executable bits + # aren't set. + self.assertEqual(stat.S_IMODE(s.st_mode), 0o666 & ~mask) finally: del sys.path[0] remove_files(TESTFN) |