~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/distutils/tests/test_util.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Tests for distutils.util."""
 
2
import sys
 
3
import unittest
 
4
 
 
5
from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
 
6
from distutils.util import byte_compile
 
7
 
 
8
class UtilTestCase(unittest.TestCase):
 
9
 
 
10
    def test_dont_write_bytecode(self):
 
11
        # makes sure byte_compile raise a DistutilsError
 
12
        # if sys.dont_write_bytecode is True
 
13
        old_dont_write_bytecode = sys.dont_write_bytecode
 
14
        sys.dont_write_bytecode = True
 
15
        try:
 
16
            self.assertRaises(DistutilsByteCompileError, byte_compile, [])
 
17
        finally:
 
18
            sys.dont_write_bytecode = old_dont_write_bytecode
 
19
 
 
20
def test_suite():
 
21
    return unittest.makeSuite(UtilTestCase)
 
22
 
 
23
if __name__ == "__main__":
 
24
    unittest.main(defaultTest="test_suite")