2009-02-13 18:22:03 -04:00
|
|
|
"""Tests for distutils.util."""
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
2009-10-24 12:10:37 -03:00
|
|
|
from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
|
2010-03-04 20:16:02 -04:00
|
|
|
from distutils.util import byte_compile
|
2009-07-16 12:35:45 -03:00
|
|
|
|
2010-03-04 20:16:02 -04:00
|
|
|
class UtilTestCase(unittest.TestCase):
|
2009-07-16 12:35:45 -03:00
|
|
|
|
2009-10-24 12:10:37 -03: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 12:19:03 -03:00
|
|
|
sys.dont_write_bytecode = old_dont_write_bytecode
|
2009-10-24 12:10:37 -03:00
|
|
|
|
2009-02-13 18:22:03 -04:00
|
|
|
def test_suite():
|
2009-05-10 09:17:30 -03:00
|
|
|
return unittest.makeSuite(UtilTestCase)
|
2009-02-13 18:22:03 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main(defaultTest="test_suite")
|