Issue #7071: byte-compilation in Distutils now looks at sys.dont_write_bytecode

This commit is contained in:
Tarek Ziadé 2009-10-24 15:10:37 +00:00
parent da8652d920
commit b9c1cfc428
8 changed files with 67 additions and 5 deletions

View file

@ -89,6 +89,22 @@ class BuildPyTestCase(support.TempdirManager,
os.chdir(cwd)
sys.stdout = sys.__stdout__
def test_dont_write_bytecode(self):
# makes sure byte_compile is not used
pkg_dir, dist = self.create_dist()
cmd = build_py(dist)
cmd.compile = 1
cmd.optimize = 1
old_dont_write_bytecode = sys.dont_write_bytecode
sys.dont_write_bytecode = True
try:
cmd.byte_compile([])
finally:
sys.dont_write_bytecode = old_dont_write_bytecode
self.assertTrue('byte-compile not supported ' in self.logs[0][1])
def test_suite():
return unittest.makeSuite(BuildPyTestCase)