codekingpro/portable-devtools
114k
1"""Tests for distutils.command.bdist."""2 3from distutils.command.bdist import bdist4from distutils.tests import support5 6 7class TestBuild(support.TempdirManager):8 def test_formats(self):9 # let's create a command and make sure10 # we can set the format11 dist = self.create_dist()[1]12 cmd = bdist(dist)13 cmd.formats = ['gztar']14 cmd.ensure_finalized()15 assert cmd.formats == ['gztar']16 17 # what formats does bdist offer?18 formats = [19 'bztar',20 'gztar',21 'rpm',22 'tar',23 'xztar',24 'zip',25 'ztar',26 ]27 found = sorted(cmd.format_commands)28 assert found == formats29 30 def test_skip_build(self):31 # bug #10946: bdist --skip-build should trickle down to subcommands32 dist = self.create_dist()[1]33 cmd = bdist(dist)34 cmd.skip_build = True35 cmd.ensure_finalized()36 dist.command_obj['bdist'] = cmd37 38 names = [39 'bdist_dumb',40 ] # bdist_rpm does not support --skip-build41 42 for name in names:43 subcmd = cmd.get_finalized_command(name)44 if getattr(subcmd, '_unsupported', False):45 # command is not supported on this build46 continue47 assert subcmd.skip_build, f'{name} should take --skip-build from bdist'48 