summaryrefslogtreecommitdiff
path: root/Lib/test/test_compileall.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-04 10:26:46 +0000
committerGeorg Brandl <georg@python.org>2010-12-04 10:26:46 +0000
commite652f1b1b4166521e134d6312eebe9b761ea78e5 (patch)
treee92329925a8e37d2908af04744048facff3500a4 /Lib/test/test_compileall.py
parentcfd4a9e97b4d7d8d1b3bc8db735625d3904375ab (diff)
downloadcpython-e652f1b1b4166521e134d6312eebe9b761ea78e5.tar.gz
Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.
Diffstat (limited to 'Lib/test/test_compileall.py')
-rw-r--r--Lib/test/test_compileall.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index 1955006fd0..4246b2f5da 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -88,6 +88,15 @@ class CompileallTests(unittest.TestCase):
compileall.compile_file(data_file)
self.assertFalse(os.path.exists(os.path.join(data_dir, '__pycache__')))
+ def test_optimize(self):
+ # make sure compiling with different optimization settings than the
+ # interpreter's creates the correct file names
+ optimize = 1 if __debug__ else 0
+ compileall.compile_dir(self.directory, quiet=True, optimize=optimize)
+ cached = imp.cache_from_source(self.source_path,
+ debug_override=not optimize)
+ self.assertTrue(os.path.isfile(cached))
+
class EncodingTest(unittest.TestCase):
"""Issue 6716: compileall should escape source code when printing errors