summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-04-13 20:07:23 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-04-13 20:07:23 (GMT)
commitc44865a345364573a68a14fe546b34b54ed2b3de (patch)
tree96ac74b5ea39b39711b18b4ab185d7d8435d8c51 /Lib/distutils/tests
parent9e94ddfb579e3010de473373e86e5f30016f40be (diff)
downloadcpython-c44865a345364573a68a14fe546b34b54ed2b3de.zip
cpython-c44865a345364573a68a14fe546b34b54ed2b3de.tar.gz
cpython-c44865a345364573a68a14fe546b34b54ed2b3de.tar.bz2
Merged revisions 71585 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71585 | tarek.ziade | 2009-04-13 22:03:44 +0200 (Mon, 13 Apr 2009) | 1 line improved test coverage for distutils.cmd ........
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_cmd.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_cmd.py b/Lib/distutils/tests/test_cmd.py
index a252c35..8f2b36f 100644
--- a/Lib/distutils/tests/test_cmd.py
+++ b/Lib/distutils/tests/test_cmd.py
@@ -1,5 +1,6 @@
"""Tests for distutils.cmd."""
import unittest
+import os
from distutils.cmd import Command
from distutils.dist import Distribution
@@ -62,6 +63,45 @@ class CommandTestCase(unittest.TestCase):
' option2 = 1']
self.assertEquals(msgs, wanted)
+ def test_ensure_string(self):
+ cmd = self.cmd
+ cmd.option1 = 'ok'
+ cmd.ensure_string('option1')
+
+ cmd.option2 = None
+ cmd.ensure_string('option2', 'xxx')
+ self.assert_(hasattr(cmd, 'option2'))
+
+ cmd.option3 = 1
+ self.assertRaises(DistutilsOptionError, cmd.ensure_string, 'option3')
+
+ def test_ensure_string_list(self):
+ cmd = self.cmd
+ cmd.option1 = 'ok,dok'
+ cmd.ensure_string_list('option1')
+ self.assertEquals(cmd.option1, ['ok', 'dok'])
+
+ cmd.option2 = ['xxx', 'www']
+ cmd.ensure_string_list('option2')
+
+ cmd.option3 = ['ok', 2]
+ self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
+ 'option3')
+
+ def test_ensure_filename(self):
+ cmd = self.cmd
+ cmd.option1 = __file__
+ cmd.ensure_filename('option1')
+ cmd.option2 = 'xxx'
+ self.assertRaises(DistutilsOptionError, cmd.ensure_filename, 'option2')
+
+ def test_ensure_dirname(self):
+ cmd = self.cmd
+ cmd.option1 = os.path.dirname(__file__)
+ cmd.ensure_dirname('option1')
+ cmd.option2 = 'xxx'
+ self.assertRaises(DistutilsOptionError, cmd.ensure_dirname, 'option2')
+
def test_suite():
return unittest.makeSuite(CommandTestCase)