Tarek Ziadé | f637050 | 2009-04-05 22:57:21 +0000 | [diff] [blame] | 1 | """Tests for distutils.command.bdist.""" |
| 2 | import unittest |
| 3 | import sys |
| 4 | import os |
| 5 | import tempfile |
| 6 | import shutil |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 7 | from test.support import run_unittest |
Tarek Ziadé | f637050 | 2009-04-05 22:57:21 +0000 | [diff] [blame] | 8 | |
| 9 | from distutils.core import Distribution |
| 10 | from distutils.command.bdist import bdist |
| 11 | from distutils.tests import support |
| 12 | from distutils.spawn import find_executable |
| 13 | from distutils import spawn |
| 14 | from distutils.errors import DistutilsExecError |
| 15 | |
| 16 | class BuildTestCase(support.TempdirManager, |
| 17 | unittest.TestCase): |
| 18 | |
| 19 | def test_formats(self): |
| 20 | |
| 21 | # let's create a command and make sure |
| 22 | # we can fix the format |
| 23 | pkg_pth, dist = self.create_dist() |
| 24 | cmd = bdist(dist) |
| 25 | cmd.formats = ['msi'] |
| 26 | cmd.ensure_finalized() |
| 27 | self.assertEquals(cmd.formats, ['msi']) |
| 28 | |
| 29 | # what format bdist offers ? |
| 30 | # XXX an explicit list in bdist is |
| 31 | # not the best way to bdist_* commands |
| 32 | # we should add a registry |
| 33 | formats = ['rpm', 'zip', 'gztar', 'bztar', 'ztar', |
| 34 | 'tar', 'wininst', 'msi'] |
| 35 | formats.sort() |
| 36 | founded = list(cmd.format_command.keys()) |
| 37 | founded.sort() |
| 38 | self.assertEquals(founded, formats) |
| 39 | |
| 40 | def test_suite(): |
| 41 | return unittest.makeSuite(BuildTestCase) |
| 42 | |
| 43 | if __name__ == '__main__': |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 44 | run_unittest(test_suite()) |