summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-08-29 23:42:50 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-08-29 23:42:50 (GMT)
commitb9fe54cccc3798f089489ef1e7f9026a35d16d6b (patch)
treee28f0aa1563038ff6cc0678cc3f327503623d540 /Lib/packaging/tests
parent83ab3f319b3b83c84c4df72349b6ce7d5ec936da (diff)
downloadcpython-b9fe54cccc3798f089489ef1e7f9026a35d16d6b.zip
cpython-b9fe54cccc3798f089489ef1e7f9026a35d16d6b.tar.gz
cpython-b9fe54cccc3798f089489ef1e7f9026a35d16d6b.tar.bz2
Make bdist_* commands respect --skip-build passed to bdist (#10946).
There was already a test for this, but it was complicated and had a subtle bug (custom command objects need to be put in dist.command_obj so that other command objects may see them) that rendered it moot.
Diffstat (limited to 'Lib/packaging/tests')
-rw-r--r--Lib/packaging/tests/test_command_bdist.py42
1 files changed, 13 insertions, 29 deletions
diff --git a/Lib/packaging/tests/test_command_bdist.py b/Lib/packaging/tests/test_command_bdist.py
index fa4093c..dd10188 100644
--- a/Lib/packaging/tests/test_command_bdist.py
+++ b/Lib/packaging/tests/test_command_bdist.py
@@ -1,8 +1,6 @@
"""Tests for distutils.command.bdist."""
-
-from packaging import util
+import os
from packaging.command.bdist import bdist, show_formats
-
from packaging.tests import unittest, support, captured_stdout
@@ -10,22 +8,6 @@ class BuildTestCase(support.TempdirManager,
support.LoggingCatcher,
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
# we can set the format
@@ -35,7 +17,7 @@ class BuildTestCase(support.TempdirManager,
cmd.ensure_finalized()
self.assertEqual(cmd.formats, ['msi'])
- # what format does bdist offer?
+ # what formats does bdist offer?
# XXX hard-coded lists are not the best way to find available bdist_*
# commands; we should add a registry
formats = ['bztar', 'gztar', 'msi', 'tar', 'wininst', 'zip']
@@ -43,19 +25,21 @@ class BuildTestCase(support.TempdirManager,
self.assertEqual(found, formats)
def test_skip_build(self):
- dist = self.create_dist()[1]
- cmd = bdist(dist)
- cmd.skip_build = False
- cmd.formats = ['ztar']
- cmd.ensure_finalized()
- self.assertFalse(self._get_platform_called)
-
+ # bug #10946: bdist --skip-build should trickle down to subcommands
dist = self.create_dist()[1]
cmd = bdist(dist)
cmd.skip_build = True
- cmd.formats = ['ztar']
cmd.ensure_finalized()
- self.assertTrue(self._get_platform_called)
+ dist.command_obj['bdist'] = cmd
+
+ names = ['bdist_dumb', 'bdist_wininst']
+ if os.name == 'nt':
+ names.append('bdist_msi')
+
+ for name in names:
+ subcmd = cmd.get_finalized_command(name)
+ self.assertTrue(subcmd.skip_build,
+ '%s should take --skip-build from bdist' % name)
def test_show_formats(self):
__, stdout = captured_stdout(show_formats)