Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: bd371a4cbb0cdf4fb2b726134747c3ea062c5321 authored by Barry Warsaw on 17 March 2012, 22:19:15 UTC
Bump to 2.6.8rc2
Tip revision: bd371a4
test_util.py
"""Tests for distutils.util."""
import sys
import unittest

from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
from distutils.util import byte_compile

class UtilTestCase(unittest.TestCase):

    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:
            sys.dont_write_bytecode = old_dont_write_bytecode

def test_suite():
    return unittest.makeSuite(UtilTestCase)

if __name__ == "__main__":
    unittest.main(defaultTest="test_suite")
back to top