summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_dist.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_dist.py')
-rw-r--r--Lib/distutils/tests/test_dist.py85
1 files changed, 3 insertions, 82 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 4f51c16..3b7637f 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -7,9 +7,8 @@ import unittest
import warnings
import textwrap
-from distutils.dist import Distribution, fix_help_options, DistributionMetadata
+from distutils.dist import Distribution, fix_help_options
from distutils.cmd import Command
-import distutils.dist
from test.support import TESTFN, captured_stdout
from distutils.tests import support
@@ -38,8 +37,7 @@ class TestDistribution(Distribution):
return self._config_files
-class DistributionTestCase(support.TempdirManager,
- support.LoggingSilencer,
+class DistributionTestCase(support.LoggingSilencer,
support.EnvironGuard,
unittest.TestCase):
@@ -60,27 +58,6 @@ class DistributionTestCase(support.TempdirManager,
d.parse_command_line()
return d
- def test_debug_mode(self):
- with open(TESTFN, "w") as f:
- f.write("[global]")
- f.write("command_packages = foo.bar, splat")
-
- files = [TESTFN]
- sys.argv.append("build")
-
- with captured_stdout() as stdout:
- self.create_distribution(files)
- stdout.seek(0)
- self.assertEquals(stdout.read(), '')
- distutils.dist.DEBUG = True
- try:
- with captured_stdout() as stdout:
- self.create_distribution(files)
- stdout.seek(0)
- self.assertEquals(stdout.read(), '')
- finally:
- distutils.dist.DEBUG = False
-
def test_command_packages_unspecified(self):
sys.argv.append("build")
d = self.create_distribution()
@@ -182,35 +159,6 @@ class DistributionTestCase(support.TempdirManager,
kwargs = {'level': 'ok2'}
self.assertRaises(ValueError, dist.announce, args, kwargs)
- def test_find_config_files_disable(self):
- # Ticket #1180: Allow user to disable their home config file.
- temp_home = self.mkdtemp()
- if os.name == 'posix':
- user_filename = os.path.join(temp_home, ".pydistutils.cfg")
- else:
- user_filename = os.path.join(temp_home, "pydistutils.cfg")
-
- with open(user_filename, 'w') as f:
- f.write('[distutils]\n')
-
- def _expander(path):
- return temp_home
-
- old_expander = os.path.expanduser
- os.path.expanduser = _expander
- try:
- d = distutils.dist.Distribution()
- all_files = d.find_config_files()
-
- d = distutils.dist.Distribution(attrs={'script_args':
- ['--no-user-cfg']})
- files = d.find_config_files()
- finally:
- os.path.expanduser = old_expander
-
- # make sure --no-user-cfg disables the user cfg file
- self.assertEquals(len(all_files)-1, len(files))
-
class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
unittest.TestCase):
@@ -364,38 +312,11 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
"version": "1.0",
"long_description": long_desc}
- dist = distutils.dist.Distribution(attrs)
+ dist = Distribution(attrs)
meta = self.format_metadata(dist)
meta = meta.replace('\n' + 8 * ' ', '\n')
self.assertTrue(long_desc in meta)
- def test_read_metadata(self):
- attrs = {"name": "package",
- "version": "1.0",
- "long_description": "desc",
- "description": "xxx",
- "download_url": "http://example.com",
- "keywords": ['one', 'two'],
- "requires": ['foo']}
-
- dist = Distribution(attrs)
- metadata = dist.metadata
-
- # write it then reloads it
- PKG_INFO = io.StringIO()
- metadata.write_pkg_file(PKG_INFO)
- PKG_INFO.seek(0)
- metadata.read_pkg_file(PKG_INFO)
-
- self.assertEquals(metadata.name, "package")
- self.assertEquals(metadata.version, "1.0")
- self.assertEquals(metadata.description, "xxx")
- self.assertEquals(metadata.download_url, 'http://example.com')
- self.assertEquals(metadata.keywords, ['one', 'two'])
- self.assertEquals(metadata.platforms, ['UNKNOWN'])
- self.assertEquals(metadata.obsoletes, None)
- self.assertEquals(metadata.requires, ['foo'])
-
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(DistributionTestCase))