diff options
author | Éric Araujo <merwok@netwok.org> | 2011-10-09 07:25:33 +0200 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-10-09 07:25:33 +0200 |
commit | 5819dcc0d262ef0ceaffc68d1b65f3d031e27b68 (patch) | |
tree | fb0ba1a6de80e929c687c0ba9a83197f1a7e676d | |
parent | 8af607b4c828297b74e28ae58e01aebe4412f916 (diff) | |
download | cpython-git-5819dcc0d262ef0ceaffc68d1b65f3d031e27b68.tar.gz |
Add tests for Unicode handling in distutils’ check and register (#13114)
-rw-r--r-- | Lib/distutils/tests/test_check.py | 13 | ||||
-rw-r--r-- | Lib/distutils/tests/test_register.py | 20 |
2 files changed, 30 insertions, 3 deletions
diff --git a/Lib/distutils/tests/test_check.py b/Lib/distutils/tests/test_check.py index 229ae25c6d..4de64734c4 100644 --- a/Lib/distutils/tests/test_check.py +++ b/Lib/distutils/tests/test_check.py @@ -46,6 +46,15 @@ class CheckTestCase(support.LoggingSilencer, cmd = self._run(metadata, strict=1) self.assertEqual(cmd._warnings, 0) + # now a test with non-ASCII characters + metadata = {'url': 'xxx', 'author': '\u00c9ric', + 'author_email': 'xxx', 'name': 'xxx', + 'version': 'xxx', + 'description': 'Something about esszet \u00df', + 'long_description': 'More things about esszet \u00df'} + cmd = self._run(metadata) + self.assertEqual(cmd._warnings, 0) + def test_check_document(self): if not HAS_DOCUTILS: # won't test without docutils return @@ -80,8 +89,8 @@ class CheckTestCase(support.LoggingSilencer, self.assertRaises(DistutilsSetupError, self._run, metadata, **{'strict': 1, 'restructuredtext': 1}) - # and non-broken rest - metadata['long_description'] = 'title\n=====\n\ntest' + # and non-broken rest, including a non-ASCII character to test #12114 + metadata['long_description'] = 'title\n=====\n\ntest \u00df' cmd = self._run(metadata, strict=1, restructuredtext=1) self.assertEqual(cmd._warnings, 0) diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py index cb72a11538..5863ae1422 100644 --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -214,7 +214,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): # metadata are OK but long_description is broken metadata = {'url': 'xxx', 'author': 'xxx', - 'author_email': 'xxx', + 'author_email': 'éxéxé', 'name': 'xxx', 'version': 'xxx', 'long_description': 'title\n==\n\ntext'} @@ -247,6 +247,24 @@ class RegisterTestCase(PyPIRCCommandTestCase): finally: del register_module.input + # and finally a Unicode test (bug #12114) + metadata = {'url': 'xxx', 'author': '\u00c9ric', + 'author_email': 'xxx', 'name': 'xxx', + 'version': 'xxx', + 'description': 'Something about esszet \u00df', + 'long_description': 'More things about esszet \u00df'} + + cmd = self._get_cmd(metadata) + cmd.ensure_finalized() + cmd.strict = 1 + inputs = Inputs('1', 'tarek', 'y') + register_module.input = inputs.__call__ + # let's run the command + try: + cmd.run() + finally: + del register_module.input + def test_check_metadata_deprecated(self): # makes sure make_metadata is deprecated cmd = self._get_cmd() |