mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Make test work with -O.
This commit is contained in:
parent
8a624a9eb0
commit
00e1f63c6e
1 changed files with 8 additions and 2 deletions
|
@ -7,7 +7,8 @@ import sys
|
||||||
import py_compile
|
import py_compile
|
||||||
import warnings
|
import warnings
|
||||||
import marshal
|
import marshal
|
||||||
from test.test_support import unlink, TESTFN, unload, run_unittest, check_warnings
|
from test.test_support import (unlink, TESTFN, unload, run_unittest,
|
||||||
|
check_warnings, TestFailed)
|
||||||
|
|
||||||
|
|
||||||
def remove_files(name):
|
def remove_files(name):
|
||||||
|
@ -102,7 +103,12 @@ class ImportTest(unittest.TestCase):
|
||||||
os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
|
os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
|
||||||
stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
|
stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
|
||||||
__import__(TESTFN)
|
__import__(TESTFN)
|
||||||
s = os.stat(fname + 'c')
|
fn = fname + 'c'
|
||||||
|
if not os.path.exists(fn):
|
||||||
|
fn = fname + 'o'
|
||||||
|
if not os.path.exists(fn): raise TestFailed("__import__ did "
|
||||||
|
"not result in creation of either a .pyc or .pyo file")
|
||||||
|
s = os.stat(fn)
|
||||||
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:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue