2009-02-13 22:22:03 +00:00
|
|
|
"""Tests for distutils.util."""
|
|
|
|
|
import sys
|
|
|
|
|
import unittest
|
|
|
|
|
|
2009-10-24 15:10:37 +00:00
|
|
|
from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
|
2010-03-05 00:16:02 +00:00
|
|
|
from distutils.util import byte_compile
|
2009-07-16 15:35:45 +00:00
|
|
|
|
2010-03-05 00:16:02 +00:00
|
|
|
class UtilTestCase(unittest.TestCase):
|
2009-07-16 15:35:45 +00:00
|
|
|
|
2009-10-24 15:10:37 +00:00
|
|
|
def test_dont_write_bytecode(self):
|
|
|
|
|
# makes sure byte_compile raise a DistutilsError
|
|
|
|
|
# if sys.dont_write_bytecode is True
|
|
|
|
|
old_dont_write_bytecode = sys.dont_write_bytecode
|
|
|
|
|
sys.dont_write_bytecode = True
|
|
|
|
|
try:
|
|
|
|
|
self.assertRaises(DistutilsByteCompileError, byte_compile, [])
|
|
|
|
|
finally:
|
2009-10-24 15:19:03 +00:00
|
|
|
sys.dont_write_bytecode = old_dont_write_bytecode
|
2009-10-24 15:10:37 +00:00
|
|
|
|
2009-02-13 22:22:03 +00:00
|
|
|
def test_suite():
|
2009-05-10 12:17:30 +00:00
|
|
|
return unittest.makeSuite(UtilTestCase)
|
2009-02-13 22:22:03 +00:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
unittest.main(defaultTest="test_suite")
|