Commit 49443195 authored by Tarek Ziadé's avatar Tarek Ziadé

improved distutils.dist test coverage, pep-8 compliancy

parent c9712ebc
This diff is collapsed.
# -*- coding: latin-1 -*-
# -*- coding: utf8 -*-
"""Tests for distutils.dist."""
import os
......@@ -36,7 +36,9 @@ class TestDistribution(Distribution):
return self._config_files
class DistributionTestCase(support.TempdirManager, unittest.TestCase):
class DistributionTestCase(support.TempdirManager,
support.LoggingSilencer,
unittest.TestCase):
def setUp(self):
super(DistributionTestCase, self).setUp()
......@@ -106,11 +108,11 @@ class DistributionTestCase(support.TempdirManager, unittest.TestCase):
my_file = os.path.join(tmp_dir, 'f')
klass = Distribution
dist = klass(attrs={'author': u'Mister Caf',
dist = klass(attrs={'author': u'Mister Café',
'name': 'my.package',
'maintainer': u'Caf Junior',
'description': u'Caf torrfi',
'long_description': u'Hhh'})
'maintainer': u'Café Junior',
'description': u'Café torréfié',
'long_description': u'Héhéhé'})
# let's make sure the file can be written
......@@ -151,6 +153,49 @@ class DistributionTestCase(support.TempdirManager, 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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment