diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-12-08 09:45:25 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-12-08 09:45:25 (GMT) |
commit | b88a49607a6e36489a41003a66b673f573f32069 (patch) | |
tree | 397cb44893ec683ae459905d4b3d2f022a462410 /Lib/distutils/tests/test_dist.py | |
parent | 0b9293f28bcfc05cb67b2b3f9c6c1fec3194ea28 (diff) | |
download | cpython-b88a49607a6e36489a41003a66b673f573f32069.zip cpython-b88a49607a6e36489a41003a66b673f573f32069.tar.gz cpython-b88a49607a6e36489a41003a66b673f573f32069.tar.bz2 |
Merged revisions 76702,76704 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76702 | tarek.ziade | 2009-12-08 09:56:49 +0100 (Tue, 08 Dec 2009) | 1 line
Issue #7457: added a read_pkg_file method to distutils.dist.DistributionMetadata so we can read back PKG-INFO files
........
r76704 | tarek.ziade | 2009-12-08 10:39:51 +0100 (Tue, 08 Dec 2009) | 1 line
removed the usage of rfc822 in favor of email.message.Message
........
Diffstat (limited to 'Lib/distutils/tests/test_dist.py')
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 0e7d532..4f51c16 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -7,7 +7,7 @@ import unittest import warnings import textwrap -from distutils.dist import Distribution, fix_help_options +from distutils.dist import Distribution, fix_help_options, DistributionMetadata from distutils.cmd import Command import distutils.dist @@ -369,6 +369,33 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard, 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)) |