ยปCore Development>Code coverage>Lib/distutils/tests/test_bdist.py

Python code coverage for Lib/distutils/tests/test_bdist.py

#countcontent
1n/a"""Tests for distutils.command.bdist."""
2n/aimport os
3n/aimport unittest
4n/afrom test.support import run_unittest
5n/a
6n/afrom distutils.command.bdist import bdist
7n/afrom distutils.tests import support
8n/a
9n/a
10n/aclass BuildTestCase(support.TempdirManager,
11n/a unittest.TestCase):
12n/a
13n/a def test_formats(self):
14n/a # let's create a command and make sure
15n/a # we can set the format
16n/a dist = self.create_dist()[1]
17n/a cmd = bdist(dist)
18n/a cmd.formats = ['msi']
19n/a cmd.ensure_finalized()
20n/a self.assertEqual(cmd.formats, ['msi'])
21n/a
22n/a # what formats does bdist offer?
23n/a formats = ['bztar', 'gztar', 'msi', 'rpm', 'tar',
24n/a 'wininst', 'xztar', 'zip', 'ztar']
25n/a found = sorted(cmd.format_command)
26n/a self.assertEqual(found, formats)
27n/a
28n/a def test_skip_build(self):
29n/a # bug #10946: bdist --skip-build should trickle down to subcommands
30n/a dist = self.create_dist()[1]
31n/a cmd = bdist(dist)
32n/a cmd.skip_build = 1
33n/a cmd.ensure_finalized()
34n/a dist.command_obj['bdist'] = cmd
35n/a
36n/a names = ['bdist_dumb', 'bdist_wininst'] # bdist_rpm does not support --skip-build
37n/a if os.name == 'nt':
38n/a names.append('bdist_msi')
39n/a
40n/a for name in names:
41n/a subcmd = cmd.get_finalized_command(name)
42n/a self.assertTrue(subcmd.skip_build,
43n/a '%s should take --skip-build from bdist' % name)
44n/a
45n/a
46n/adef test_suite():
47n/a return unittest.makeSuite(BuildTestCase)
48n/a
49n/aif __name__ == '__main__':
50n/a run_unittest(test_suite())