mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Specify umask in execute bit test to get consistent results
and make sure we test resetting all three execute bits.
This commit is contained in:
parent
00490f2754
commit
fbf2cc4d74
1 changed files with 2 additions and 0 deletions
|
@ -97,6 +97,7 @@ class ImportTest(unittest.TestCase):
|
||||||
def test_execute_bit_not_copied(self):
|
def test_execute_bit_not_copied(self):
|
||||||
# Issue 6070: under posix .pyc files got their execute bit set if
|
# 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.
|
# the .py file had the execute bit set, but they aren't executable.
|
||||||
|
oldmask = os.umask(022)
|
||||||
try:
|
try:
|
||||||
fname = TESTFN + os.extsep + "py"
|
fname = TESTFN + os.extsep + "py"
|
||||||
f = open(fname, 'w').close()
|
f = open(fname, 'w').close()
|
||||||
|
@ -112,6 +113,7 @@ class ImportTest(unittest.TestCase):
|
||||||
self.assertEquals(stat.S_IMODE(s.st_mode),
|
self.assertEquals(stat.S_IMODE(s.st_mode),
|
||||||
stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
|
stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
|
||||||
finally:
|
finally:
|
||||||
|
os.umask(oldmask)
|
||||||
remove_files(TESTFN)
|
remove_files(TESTFN)
|
||||||
if TESTFN in sys.modules: del sys.modules[TESTFN]
|
if TESTFN in sys.modules: del sys.modules[TESTFN]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue