diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-06 09:03:10 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-06 09:03:10 (GMT) |
commit | 9b6ddb8eb74a59793fa4262c63b384313024fd3a (patch) | |
tree | 0c7556a692f9f6854b656726f8e74045fed69783 /Lib/distutils | |
parent | d33088259bed9cd5e7be2ed3e04be5da6c7270c7 (diff) | |
download | cpython-9b6ddb8eb74a59793fa4262c63b384313024fd3a.zip cpython-9b6ddb8eb74a59793fa4262c63b384313024fd3a.tar.gz cpython-9b6ddb8eb74a59793fa4262c63b384313024fd3a.tar.bz2 |
Merged revisions 69360 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69360 | tarek.ziade | 2009-02-06 09:55:23 +0100 (Fri, 06 Feb 2009) | 1 line
removed types usage and added test coverage (work for #3986)
........
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/cmd.py | 2 | ||||
-rw-r--r-- | Lib/distutils/tests/test_cmd.py | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py index c6572ca..4669dc2 100644 --- a/Lib/distutils/cmd.py +++ b/Lib/distutils/cmd.py @@ -7,7 +7,7 @@ in the distutils.command package. __revision__ = "$Id$" import sys, os, re -from distutils.errors import * +from distutils.errors import DistutilsOptionError from distutils import util, dir_util, file_util, archive_util, dep_util from distutils import log diff --git a/Lib/distutils/tests/test_cmd.py b/Lib/distutils/tests/test_cmd.py new file mode 100644 index 0000000..19079c0 --- /dev/null +++ b/Lib/distutils/tests/test_cmd.py @@ -0,0 +1,38 @@ +"""Tests for distutils.cmd.""" +import unittest + +from distutils.cmd import Command +from distutils.dist import Distribution +from distutils.errors import DistutilsOptionError + +class CommandTestCase(unittest.TestCase): + + def test_ensure_string_list(self): + + class MyCmd(Command): + + def initialize_options(self): + pass + + dist = Distribution() + cmd = MyCmd(dist) + + cmd.not_string_list = ['one', 2, 'three'] + cmd.yes_string_list = ['one', 'two', 'three'] + cmd.not_string_list2 = object() + cmd.yes_string_list2 = 'ok' + + cmd.ensure_string_list('yes_string_list') + cmd.ensure_string_list('yes_string_list2') + + self.assertRaises(DistutilsOptionError, + cmd.ensure_string_list, 'not_string_list') + + self.assertRaises(DistutilsOptionError, + cmd.ensure_string_list, 'not_string_list2') + +def test_suite(): + return unittest.makeSuite(CommandTestCase) + +if __name__ == '__main__': + test_support.run_unittest(test_suite()) |