test_bdist.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """Tests for distutils.command.bdist."""
  2. from distutils.command.bdist import bdist
  3. from distutils.tests import support
  4. class TestBuild(support.TempdirManager):
  5. def test_formats(self):
  6. # let's create a command and make sure
  7. # we can set the format
  8. dist = self.create_dist()[1]
  9. cmd = bdist(dist)
  10. cmd.formats = ['gztar']
  11. cmd.ensure_finalized()
  12. assert cmd.formats == ['gztar']
  13. # what formats does bdist offer?
  14. formats = [
  15. 'bztar',
  16. 'gztar',
  17. 'rpm',
  18. 'tar',
  19. 'xztar',
  20. 'zip',
  21. 'ztar',
  22. ]
  23. found = sorted(cmd.format_commands)
  24. assert found == formats
  25. def test_skip_build(self):
  26. # bug #10946: bdist --skip-build should trickle down to subcommands
  27. dist = self.create_dist()[1]
  28. cmd = bdist(dist)
  29. cmd.skip_build = True
  30. cmd.ensure_finalized()
  31. dist.command_obj['bdist'] = cmd
  32. names = [
  33. 'bdist_dumb',
  34. ] # bdist_rpm does not support --skip-build
  35. for name in names:
  36. subcmd = cmd.get_finalized_command(name)
  37. if getattr(subcmd, '_unsupported', False):
  38. # command is not supported on this build
  39. continue
  40. assert subcmd.skip_build, f'{name} should take --skip-build from bdist'