summaryrefslogtreecommitdiff
path: root/Lib/distutils/tests/test_sdist.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-05-16 16:52:13 +0000
committerTarek Ziadé <ziade.tarek@gmail.com>2009-05-16 16:52:13 +0000
commita9462ebacac886f1d8e213d8c027310d427b1424 (patch)
treecaa70c4f467f9a77662ae34fe70812541501ec58 /Lib/distutils/tests/test_sdist.py
parent0d1035bd2d6bc0e883586b29ffa59aa02105b448 (diff)
downloadcpython-a9462ebacac886f1d8e213d8c027310d427b1424.tar.gz
Merged revisions 72681 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72681 | tarek.ziade | 2009-05-16 18:37:06 +0200 (Sat, 16 May 2009) | 1 line #6041: sdist and register now use the check command. No more duplicate code for metadata checking ........
Diffstat (limited to 'Lib/distutils/tests/test_sdist.py')
-rw-r--r--Lib/distutils/tests/test_sdist.py39
1 files changed, 35 insertions, 4 deletions
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
index 9e27933773..b7e5859cb9 100644
--- a/Lib/distutils/tests/test_sdist.py
+++ b/Lib/distutils/tests/test_sdist.py
@@ -6,7 +6,9 @@ import zipfile
from os.path import join
import sys
import tempfile
+import warnings
+from test.support import check_warnings
from test.support import captured_stdout
from distutils.command.sdist import sdist
@@ -16,6 +18,7 @@ from distutils.tests.test_config import PyPIRCCommandTestCase
from distutils.errors import DistutilsExecError, DistutilsOptionError
from distutils.spawn import find_executable
from distutils.tests import support
+from distutils.log import WARN
from distutils.archive_util import ARCHIVE_FORMATS
SETUP_PY = """
@@ -38,12 +41,12 @@ somecode%(sep)sdoc.dat
somecode%(sep)sdoc.txt
"""
-class sdistTestCase(PyPIRCCommandTestCase):
+class SDistTestCase(PyPIRCCommandTestCase):
def setUp(self):
# PyPIRCCommandTestCase creates a temp dir already
# and put it in self.tmp_dir
- super(sdistTestCase, self).setUp()
+ super(SDistTestCase, self).setUp()
# setting up an environment
self.old_path = os.getcwd()
os.mkdir(join(self.tmp_dir, 'somecode'))
@@ -57,7 +60,7 @@ class sdistTestCase(PyPIRCCommandTestCase):
def tearDown(self):
# back to normal
os.chdir(self.old_path)
- super(sdistTestCase, self).tearDown()
+ super(SDistTestCase, self).tearDown()
def get_cmd(self, metadata=None):
"""Returns a cmd"""
@@ -214,6 +217,34 @@ class sdistTestCase(PyPIRCCommandTestCase):
manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
self.assertEquals(manifest, MANIFEST % {'sep': os.sep})
+ def test_metadata_check_option(self):
+ # testing the `medata-check` option
+ dist, cmd = self.get_cmd(metadata={})
+
+ # this should raise some warnings !
+ # with the `check` subcommand
+ cmd.ensure_finalized()
+ cmd.run()
+ warnings = self.get_logs(WARN)
+ self.assertEquals(len(warnings), 2)
+
+ # trying with a complete set of metadata
+ self.clear_logs()
+ dist, cmd = self.get_cmd()
+ cmd.ensure_finalized()
+ cmd.metadata_check = 0
+ cmd.run()
+ warnings = self.get_logs(WARN)
+ self.assertEquals(len(warnings), 0)
+
+ def test_check_metadata_deprecated(self):
+ # makes sure make_metadata is deprecated
+ dist, cmd = self.get_cmd()
+ with check_warnings() as w:
+ warnings.simplefilter("always")
+ cmd.check_metadata()
+ self.assertEquals(len(w.warnings), 1)
+
def test_show_formats(self):
with captured_stdout() as stdout:
show_formats()
@@ -247,7 +278,7 @@ class sdistTestCase(PyPIRCCommandTestCase):
def test_suite():
- return unittest.makeSuite(sdistTestCase)
+ return unittest.makeSuite(SDistTestCase)
if __name__ == "__main__":
unittest.main(defaultTest="test_suite")