diff options
Diffstat (limited to 'Lib/packaging/tests')
| -rw-r--r-- | Lib/packaging/tests/test_command_bdist.py | 57 | ||||
| -rw-r--r-- | Lib/packaging/tests/test_command_bdist_dumb.py | 2 | ||||
| -rw-r--r-- | Lib/packaging/tests/test_command_register.py | 2 | ||||
| -rw-r--r-- | Lib/packaging/tests/test_command_sdist.py | 2 | ||||
| -rw-r--r-- | Lib/packaging/tests/test_dist.py | 8 |
5 files changed, 26 insertions, 45 deletions
diff --git a/Lib/packaging/tests/test_command_bdist.py b/Lib/packaging/tests/test_command_bdist.py index 1522b7e..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,55 +8,38 @@ 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 fix the format - pkg_pth, dist = self.create_dist() + # we can set the format + dist = self.create_dist()[1] cmd = bdist(dist) cmd.formats = ['msi'] cmd.ensure_finalized() self.assertEqual(cmd.formats, ['msi']) - # what format bdist offers ? - # XXX an explicit list in bdist is - # not the best way to bdist_* commands - # we should add a registry - formats = sorted(('zip', 'gztar', 'bztar', 'ztar', - 'tar', 'wininst', 'msi')) + # 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'] found = sorted(cmd.format_command) self.assertEqual(found, formats) def test_skip_build(self): - pkg_pth, dist = self.create_dist() - cmd = bdist(dist) - cmd.skip_build = False - cmd.formats = ['ztar'] - cmd.ensure_finalized() - self.assertFalse(self._get_platform_called) - - pkg_pth, dist = self.create_dist() + # 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) diff --git a/Lib/packaging/tests/test_command_bdist_dumb.py b/Lib/packaging/tests/test_command_bdist_dumb.py index 25f3276..cc03fa5 100644 --- a/Lib/packaging/tests/test_command_bdist_dumb.py +++ b/Lib/packaging/tests/test_command_bdist_dumb.py @@ -35,7 +35,7 @@ class BuildDumbTestCase(support.TempdirManager, dist = Distribution({'name': 'foo', 'version': '0.1', 'py_modules': ['foo'], - 'url': 'xxx', 'author': 'xxx', + 'home-page': 'xxx', 'author': 'xxx', 'author_email': 'xxx'}) os.chdir(pkg_dir) cmd = bdist_dumb(dist) diff --git a/Lib/packaging/tests/test_command_register.py b/Lib/packaging/tests/test_command_register.py index 183f84e..9c64e2d 100644 --- a/Lib/packaging/tests/test_command_register.py +++ b/Lib/packaging/tests/test_command_register.py @@ -99,7 +99,7 @@ class RegisterTestCase(support.TempdirManager, def _get_cmd(self, metadata=None): if metadata is None: - metadata = {'url': 'xxx', 'author': 'xxx', + metadata = {'home-page': 'xxx', 'author': 'xxx', 'author_email': 'xxx', 'name': 'xxx', 'version': 'xxx'} pkg_info, dist = self.create_dist(**metadata) diff --git a/Lib/packaging/tests/test_command_sdist.py b/Lib/packaging/tests/test_command_sdist.py index bcaa630..ddc6bf7 100644 --- a/Lib/packaging/tests/test_command_sdist.py +++ b/Lib/packaging/tests/test_command_sdist.py @@ -72,7 +72,7 @@ class SDistTestCase(support.TempdirManager, """Returns a cmd""" if metadata is None: metadata = {'name': 'fake', 'version': '1.0', - 'url': 'xxx', 'author': 'xxx', + 'home_page': 'xxx', 'author': 'xxx', 'author_email': 'xxx'} dist = Distribution(metadata) dist.packages = ['somecode'] diff --git a/Lib/packaging/tests/test_dist.py b/Lib/packaging/tests/test_dist.py index 01a11ca..1d78fa9 100644 --- a/Lib/packaging/tests/test_dist.py +++ b/Lib/packaging/tests/test_dist.py @@ -98,7 +98,7 @@ class DistributionTestCase(support.TempdirManager, Distribution(attrs={'author': 'xxx', 'name': 'xxx', 'version': '1.2', - 'url': 'xxxx', + 'home-page': 'xxxx', 'badoptname': 'xxx'}) logs = self.get_logs(logging.WARNING) self.assertEqual(1, len(logs)) @@ -108,7 +108,7 @@ class DistributionTestCase(support.TempdirManager, Distribution(attrs={'author': 'xxx', 'name': 'xxx', 'version': 'xxx', - 'url': 'xxxx'}) + 'home-page': 'xxxx'}) logs = self.get_logs(logging.WARNING) self.assertEqual(1, len(logs)) self.assertIn('not a valid version', logs[0]) @@ -119,7 +119,7 @@ class DistributionTestCase(support.TempdirManager, Distribution(attrs={'author': 'xxx', 'name': 'xxx', 'version': '1.2', - 'url': 'xxxx', + 'home-page': 'xxxx', 'options': {}}) self.assertEqual([], self.get_logs(logging.WARNING)) @@ -135,7 +135,7 @@ class DistributionTestCase(support.TempdirManager, dist = Distribution(attrs={'author': 'xxx', 'name': 'xxx', 'version': 'xxx', - 'url': 'xxxx', + 'home-page': 'xxxx', 'options': {'sdist': {'owner': 'root'}}}) self.assertIn('owner', dist.get_option_dict('sdist')) |
