forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- encoding: utf8 -*- | ||
"""Tests for distutils.command.register.""" | ||
import sys | ||
import os | ||
import unittest | ||
import getpass | ||
|
@@ -11,11 +10,14 @@ | |
|
||
from distutils.command import register as register_module | ||
from distutils.command.register import register | ||
from distutils.core import Distribution | ||
from distutils.errors import DistutilsSetupError | ||
|
||
from distutils.tests import support | ||
from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase | ||
from distutils.tests.test_config import PyPIRCCommandTestCase | ||
|
||
try: | ||
import docutils | ||
except ImportError: | ||
docutils = None | ||
|
||
PYPIRC_NOPASSWORD = """\ | ||
[distutils] | ||
|
@@ -192,6 +194,7 @@ def test_password_reset(self): | |
self.assertEqual(headers['Content-length'], '290') | ||
self.assertTrue('tarek' in req.data) | ||
|
||
@unittest.skipUnless(docutils is not None, 'needs docutils') | ||
def test_strict(self): | ||
# testing the script option | ||
# when on, the register command stops if | ||
|
@@ -204,13 +207,6 @@ def test_strict(self): | |
cmd.strict = 1 | ||
self.assertRaises(DistutilsSetupError, cmd.run) | ||
|
||
# we don't test the reSt feature if docutils | ||
# is not installed | ||
try: | ||
import docutils | ||
except ImportError: | ||
return | ||
|
||
# metadata are OK but long_description is broken | ||
metadata = {'url': 'xxx', 'author': 'xxx', | ||
'author_email': u'éxéxé', | ||
|
@@ -264,6 +260,21 @@ def test_strict(self): | |
finally: | ||
del register_module.raw_input | ||
|
||
@unittest.skipUnless(docutils is not None, 'needs docutils') | ||
def test_register_invalid_long_description(self): | ||
description = ':funkie:`str`' # mimic Sphinx-specific markup | ||
metadata = {'url': 'xxx', 'author': 'xxx', | ||
'author_email': 'xxx', | ||
'name': 'xxx', 'version': 'xxx', | ||
'long_description': description} | ||
cmd = self._get_cmd(metadata) | ||
cmd.ensure_finalized() | ||
cmd.strict = True | ||
inputs = RawInputs('2', 'tarek', '[email protected]') | ||
register_module.raw_input = inputs | ||
self.addCleanup(delattr, register_module, 'raw_input') | ||
self.assertRaises(DistutilsSetupError, cmd.run) | ||
|
||
def test_check_metadata_deprecated(self): | ||
# makes sure make_metadata is deprecated | ||
cmd = self._get_cmd() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters