Home | History | Annotate | Download | only in tests
      1 """Tests for distutils.command.bdist."""
      2 import unittest
      3 import sys
      4 import os
      5 import tempfile
      6 import shutil
      7 
      8 from test.test_support import run_unittest
      9 
     10 from distutils.core import Distribution
     11 from distutils.command.bdist import bdist
     12 from distutils.tests import support
     13 from distutils.spawn import find_executable
     14 from distutils import spawn
     15 from distutils.errors import DistutilsExecError
     16 
     17 class BuildTestCase(support.TempdirManager,
     18                     unittest.TestCase):
     19 
     20     def test_formats(self):
     21 
     22         # let's create a command and make sure

     23         # we can fix the format

     24         pkg_pth, dist = self.create_dist()
     25         cmd = bdist(dist)
     26         cmd.formats = ['msi']
     27         cmd.ensure_finalized()
     28         self.assertEqual(cmd.formats, ['msi'])
     29 
     30         # what format bdist offers ?

     31         # XXX an explicit list in bdist is

     32         # not the best way to  bdist_* commands

     33         # we should add a registry

     34         formats = ['rpm', 'zip', 'gztar', 'bztar', 'ztar',
     35                    'tar', 'wininst', 'msi']
     36         formats.sort()
     37         founded = cmd.format_command.keys()
     38         founded.sort()
     39         self.assertEqual(founded, formats)
     40 
     41 def test_suite():
     42     return unittest.makeSuite(BuildTestCase)
     43 
     44 if __name__ == '__main__':
     45     run_unittest(test_suite())
     46