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