mirror of https://github.com/python/cpython
Merged revisions 72618 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72618 | tarek.ziade | 2009-05-14 14:40:59 +0200 (Thu, 14 May 2009) | 1 line more test coverage for distutils sdist command ........
This commit is contained in:
parent
4e3533ee9f
commit
aec039a892
|
@ -28,8 +28,7 @@ def show_formats ():
|
||||||
formats.append(("formats=" + format, None,
|
formats.append(("formats=" + format, None,
|
||||||
ARCHIVE_FORMATS[format][2]))
|
ARCHIVE_FORMATS[format][2]))
|
||||||
formats.sort()
|
formats.sort()
|
||||||
pretty_printer = FancyGetopt(formats)
|
FancyGetopt(formats).print_help(
|
||||||
pretty_printer.print_help(
|
|
||||||
"List of available source distribution formats:")
|
"List of available source distribution formats:")
|
||||||
|
|
||||||
class sdist (Command):
|
class sdist (Command):
|
||||||
|
|
|
@ -7,12 +7,16 @@ from os.path import join
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
from test.support import captured_stdout
|
||||||
|
|
||||||
from distutils.command.sdist import sdist
|
from distutils.command.sdist import sdist
|
||||||
|
from distutils.command.sdist import show_formats
|
||||||
from distutils.core import Distribution
|
from distutils.core import Distribution
|
||||||
from distutils.tests.test_config import PyPIRCCommandTestCase
|
from distutils.tests.test_config import PyPIRCCommandTestCase
|
||||||
from distutils.errors import DistutilsExecError
|
from distutils.errors import DistutilsExecError
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
from distutils.tests import support
|
from distutils.tests import support
|
||||||
|
from distutils.archive_util import ARCHIVE_FORMATS
|
||||||
|
|
||||||
SETUP_PY = """
|
SETUP_PY = """
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
@ -210,6 +214,16 @@ class sdistTestCase(PyPIRCCommandTestCase):
|
||||||
manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
|
manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
|
||||||
self.assertEquals(manifest, MANIFEST % {'sep': os.sep})
|
self.assertEquals(manifest, MANIFEST % {'sep': os.sep})
|
||||||
|
|
||||||
|
def test_show_formats(self):
|
||||||
|
with captured_stdout() as stdout:
|
||||||
|
show_formats()
|
||||||
|
|
||||||
|
# the output should be a header line + one line per format
|
||||||
|
num_formats = len(ARCHIVE_FORMATS.keys())
|
||||||
|
output = [line for line in stdout.getvalue().split('\n')
|
||||||
|
if line.strip().startswith('--formats=')]
|
||||||
|
self.assertEquals(len(output), num_formats)
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.makeSuite(sdistTestCase)
|
return unittest.makeSuite(sdistTestCase)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue