diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-06-01 22:36:26 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-06-01 22:36:26 (GMT) |
commit | f11be757603ba63887618ac67c9f3025e82e40f1 (patch) | |
tree | 4a3d7f783e72ae5d7f42d95c740ca156ea01a4a4 /Lib/distutils/tests | |
parent | 24e581f7b2dbb700705c7b11c3982167ac68d4cb (diff) | |
download | cpython-f11be757603ba63887618ac67c9f3025e82e40f1.zip cpython-f11be757603ba63887618ac67c9f3025e82e40f1.tar.gz cpython-f11be757603ba63887618ac67c9f3025e82e40f1.tar.bz2 |
Merged revisions 73121 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73121 | tarek.ziade | 2009-06-02 00:22:13 +0200 (Tue, 02 Jun 2009) | 1 line
improved distutils.dist test coverage, pep-8 compliancy
........
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 54b63f7..16ef68e 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -1,3 +1,4 @@ +# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os import io @@ -35,7 +36,8 @@ class TestDistribution(Distribution): return self._config_files -class DistributionTestCase(unittest.TestCase): +class DistributionTestCase(support.LoggingSilencer, + unittest.TestCase): def setUp(self): super(DistributionTestCase, self).setUp() @@ -122,6 +124,49 @@ class DistributionTestCase(unittest.TestCase): self.assertEquals(len(warns), 0) + def test_finalize_options(self): + + attrs = {'keywords': 'one,two', + 'platforms': 'one,two'} + + dist = Distribution(attrs=attrs) + dist.finalize_options() + + # finalize_option splits platforms and keywords + self.assertEquals(dist.metadata.platforms, ['one', 'two']) + self.assertEquals(dist.metadata.keywords, ['one', 'two']) + + def test_show_help(self): + class FancyGetopt(object): + def __init__(self): + self.count = 0 + + def set_option_table(self, *args): + pass + + def print_help(self, *args): + self.count += 1 + + parser = FancyGetopt() + dist = Distribution() + dist.commands = ['sdist'] + dist.script_name = 'setup.py' + dist._show_help(parser) + self.assertEquals(parser.count, 3) + + def test_get_command_packages(self): + dist = Distribution() + self.assertEquals(dist.command_packages, None) + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command']) + self.assertEquals(dist.command_packages, + ['distutils.command']) + + dist.command_packages = 'one,two' + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command', 'one', 'two']) + + class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): |