python (3.11.7)

(root)/
lib/
python3.11/
distutils/
tests/
test_bdist.py
       1  """Tests for distutils.command.bdist."""
       2  import os
       3  import unittest
       4  
       5  import warnings
       6  with warnings.catch_warnings():
       7      warnings.simplefilter('ignore', DeprecationWarning)
       8      from distutils.command.bdist import bdist
       9      from distutils.tests import support
      10  
      11  
      12  class ESC[4;38;5;81mBuildTestCase(ESC[4;38;5;149msupportESC[4;38;5;149m.ESC[4;38;5;149mTempdirManager,
      13                      ESC[4;38;5;149munittestESC[4;38;5;149m.ESC[4;38;5;149mTestCase):
      14  
      15      def test_formats(self):
      16          # let's create a command and make sure
      17          # we can set the format
      18          dist = self.create_dist()[1]
      19          cmd = bdist(dist)
      20          cmd.formats = ['tar']
      21          cmd.ensure_finalized()
      22          self.assertEqual(cmd.formats, ['tar'])
      23  
      24          # what formats does bdist offer?
      25          formats = ['bztar', 'gztar', 'rpm', 'tar', 'xztar', 'zip', 'ztar']
      26          found = sorted(cmd.format_command)
      27          self.assertEqual(found, formats)
      28  
      29      def test_skip_build(self):
      30          # bug #10946: bdist --skip-build should trickle down to subcommands
      31          dist = self.create_dist()[1]
      32          cmd = bdist(dist)
      33          cmd.skip_build = 1
      34          cmd.ensure_finalized()
      35          dist.command_obj['bdist'] = cmd
      36  
      37          for name in ['bdist_dumb']:  # bdist_rpm does not support --skip-build
      38              subcmd = cmd.get_finalized_command(name)
      39              if getattr(subcmd, '_unsupported', False):
      40                  # command is not supported on this build
      41                  continue
      42              self.assertTrue(subcmd.skip_build,
      43                              '%s should take --skip-build from bdist' % name)
      44  
      45  
      46  if __name__ == '__main__':
      47      unittest.main()