~ubuntu-branches/ubuntu/raring/python3.2/raring

« back to all changes in this revision

Viewing changes to Lib/distutils/tests/test_bdist.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-09-05 22:01:13 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: package-import@ubuntu.com-20110905220113-gmku3knwah89ojat
Tags: 3.2.2-0ubuntu1
* Python 3.2.2 release.
* Search headers in /usr/include/ncursesw for the curses/panel extensions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
"""Tests for distutils.command.bdist."""
 
2
import os
2
3
import unittest
3
 
import sys
4
 
import os
5
 
import tempfile
6
 
import shutil
7
4
from test.support import run_unittest
8
5
 
9
 
from distutils.core import Distribution
10
6
from distutils.command.bdist import bdist
11
7
from distutils.tests import support
12
 
from distutils.spawn import find_executable
13
 
from distutils import spawn
14
 
from distutils.errors import DistutilsExecError
 
8
 
15
9
 
16
10
class BuildTestCase(support.TempdirManager,
17
11
                    unittest.TestCase):
18
12
 
19
13
    def test_formats(self):
20
 
 
21
14
        # let's create a command and make sure
22
 
        # we can fix the format
23
 
        pkg_pth, dist = self.create_dist()
 
15
        # we can set the format
 
16
        dist = self.create_dist()[1]
24
17
        cmd = bdist(dist)
25
18
        cmd.formats = ['msi']
26
19
        cmd.ensure_finalized()
27
20
        self.assertEqual(cmd.formats, ['msi'])
28
21
 
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.assertEqual(founded, formats)
 
22
        # what formats does bdist offer?
 
23
        formats = ['bztar', 'gztar', 'msi', 'rpm', 'tar',
 
24
                   'wininst', 'zip', 'ztar']
 
25
        found = sorted(cmd.format_command)
 
26
        self.assertEqual(found, formats)
 
27
 
 
28
    def test_skip_build(self):
 
29
        # bug #10946: bdist --skip-build should trickle down to subcommands
 
30
        dist = self.create_dist()[1]
 
31
        cmd = bdist(dist)
 
32
        cmd.skip_build = 1
 
33
        cmd.ensure_finalized()
 
34
        dist.command_obj['bdist'] = cmd
 
35
 
 
36
        names = ['bdist_dumb', 'bdist_wininst']  # bdist_rpm does not support --skip-build
 
37
        if os.name == 'nt':
 
38
            names.append('bdist_msi')
 
39
 
 
40
        for name in names:
 
41
            subcmd = cmd.get_finalized_command(name)
 
42
            self.assertTrue(subcmd.skip_build,
 
43
                            '%s should take --skip-build from bdist' % name)
 
44
 
39
45
 
40
46
def test_suite():
41
47
    return unittest.makeSuite(BuildTestCase)