1
1
"""Tests for distutils.command.bdist."""
7
4
from test.support import run_unittest
9
from distutils.core import Distribution
10
6
from distutils.command.bdist import bdist
11
7
from distutils.tests import support
12
from distutils.spawn import find_executable
13
from distutils import spawn
14
from distutils.errors import DistutilsExecError
16
10
class BuildTestCase(support.TempdirManager,
17
11
unittest.TestCase):
19
13
def test_formats(self):
21
14
# let's create a command and make sure
22
# we can fix the format
23
pkg_pth, dist = self.create_dist()
15
# we can set the format
16
dist = self.create_dist()[1]
25
18
cmd.formats = ['msi']
26
19
cmd.ensure_finalized()
27
20
self.assertEqual(cmd.formats, ['msi'])
29
# what format bdist offers ?
30
# XXX an explicit list in bdist is
31
# not the best way to bdist_* commands
32
# we should add a registry
33
formats = ['rpm', 'zip', 'gztar', 'bztar', 'ztar',
34
'tar', 'wininst', 'msi']
36
founded = list(cmd.format_command.keys())
38
self.assertEqual(founded, formats)
22
# what formats does bdist offer?
23
formats = ['bztar', 'gztar', 'msi', 'rpm', 'tar',
24
'wininst', 'zip', 'ztar']
25
found = sorted(cmd.format_command)
26
self.assertEqual(found, formats)
28
def test_skip_build(self):
29
# bug #10946: bdist --skip-build should trickle down to subcommands
30
dist = self.create_dist()[1]
33
cmd.ensure_finalized()
34
dist.command_obj['bdist'] = cmd
36
names = ['bdist_dumb', 'bdist_wininst'] # bdist_rpm does not support --skip-build
38
names.append('bdist_msi')
41
subcmd = cmd.get_finalized_command(name)
42
self.assertTrue(subcmd.skip_build,
43
'%s should take --skip-build from bdist' % name)
41
47
return unittest.makeSuite(BuildTestCase)