[Python-checkins] distutils2: Automated merge with ssh://hg at bitbucket.org/mtlpython/distutils2
tarek.ziade
python-checkins at python.org
Sun Jan 23 15:48:23 CET 2011
tarek.ziade pushed f52d3aea3fe8 to distutils2:
http://hg.python.org/distutils2/rev/f52d3aea3fe8
changeset: 872:f52d3aea3fe8
parent: 869:56623741c144
parent: 871:72b7a71f9c32
user: Andrew Francis <af.stackless at gmail.com>
date: Wed Dec 08 23:02:39 2010 -0500
summary:
Automated merge with ssh://hg@bitbucket.org/mtlpython/distutils2
files:
diff --git a/distutils2/command/bdist.py b/distutils2/command/bdist.py
--- a/distutils2/command/bdist.py
+++ b/distutils2/command/bdist.py
@@ -4,7 +4,7 @@
distribution)."""
import os
-from distutils2.util import get_platform
+from distutils2 import util
from distutils2.command.cmd import Command
from distutils2.errors import DistutilsPlatformError, DistutilsOptionError
@@ -29,7 +29,7 @@
"temporary directory for creating built distributions"),
('plat-name=', 'p',
"platform name to embed in generated filenames "
- "(default: %s)" % get_platform()),
+ "(default: %s)" % util.get_platform()),
('formats=', None,
"formats for distribution (comma-separated list)"),
('dist-dir=', 'd',
@@ -87,7 +87,7 @@
# have to finalize 'plat_name' before 'bdist_base'
if self.plat_name is None:
if self.skip_build:
- self.plat_name = get_platform()
+ self.plat_name = util.get_platform()
else:
self.plat_name = self.get_finalized_command('build').plat_name
diff --git a/distutils2/tests/test_command_bdist.py b/distutils2/tests/test_command_bdist.py
--- a/distutils2/tests/test_command_bdist.py
+++ b/distutils2/tests/test_command_bdist.py
@@ -1,13 +1,31 @@
"""Tests for distutils.command.bdist."""
+from distutils2 import util
from distutils2.tests import run_unittest
-from distutils2.command.bdist import bdist
-from distutils2.tests import unittest, support
+from distutils2.command.bdist import bdist, show_formats
+from distutils2.tests import unittest, support, captured_stdout
+
class BuildTestCase(support.TempdirManager,
unittest.TestCase):
+ def _mock_get_platform(self):
+ self._get_platform_called = True
+ return self._get_platform()
+
+ def setUp(self):
+ super(BuildTestCase, self).setUp()
+
+ # mock util.get_platform
+ self._get_platform_called = False
+ self._get_platform = util.get_platform
+ util.get_platform = self._mock_get_platform
+
+ def tearDown(self):
+ super(BuildTestCase, self).tearDown()
+ util.get_platform = self._get_platform
+
def test_formats(self):
# let's create a command and make sure
@@ -28,6 +46,25 @@
found.sort()
self.assertEqual(found, formats)
+ def test_skip_build(self):
+ pkg_pth, dist = self.create_dist()
+ cmd = bdist(dist)
+ cmd.skip_build = True
+
+ cmd.formats = ['ztar']
+ cmd.ensure_finalized()
+ self.assertTrue(self._get_platform_called)
+
+ def test_show_formats(self):
+ __, stdout = captured_stdout(show_formats)
+
+ # the output should be a header line + one line per format
+ num_formats = len(bdist.format_commands)
+ output = [line for line in stdout.split('\n')
+ if line.strip().startswith('--formats=')]
+ self.assertEqual(len(output), num_formats)
+
+
def test_suite():
return unittest.makeSuite(BuildTestCase)
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list