| 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 BuildTestCase(support.TempdirManager, |
| 13 |
unittest.TestCase): |
| 14 |
|
| 15 |
def test_formats(self): |
| 16 |
|
| 17 |
|
| 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 |
|
| 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 |
|
| 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']: |
| 38 |
subcmd = cmd.get_finalized_command(name) |
| 39 |
if getattr(subcmd, '_unsupported', False): |
| 40 |
|
| 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() |