summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-07-09 02:06:17 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-07-09 02:06:17 (GMT)
commit00e1f63c6e4c6c356beef25bcc95e713075cec27 (patch)
tree16689f0ecf5470c5e47794f93842eeacd60e781c
parent8a624a9eb0cc036442d4ea4ffc026d1694f2fb25 (diff)
downloadcpython-00e1f63c6e4c6c356beef25bcc95e713075cec27.zip
cpython-00e1f63c6e4c6c356beef25bcc95e713075cec27.tar.gz
cpython-00e1f63c6e4c6c356beef25bcc95e713075cec27.tar.bz2
Make test work with -O.
-rw-r--r--Lib/test/test_import.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index ac6cbf2..0c4fd87 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -7,7 +7,8 @@ import sys
import py_compile
import warnings
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):
@@ -102,7 +103,12 @@ class ImportTest(unittest.TestCase):
os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
__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),
stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
finally: