[Python-checkins] distutils2: #13614: Merge changes from julien_courteau and PierrePaul regarding bad rst

eric.araujo python-checkins at python.org
Wed May 16 07:07:26 CEST 2012


http://hg.python.org/distutils2/rev/0aa2406697aa
changeset:   1327:0aa2406697aa
user:        Mathieu Leduc-Hamel <mlhamel at mtlpy.org>
date:        Sat May 12 16:02:50 2012 -0400
summary:
  #13614: Merge changes from julien_courteau and PierrePaul regarding bad rst

files:
  distutils2/metadata.py                              |   4 +-
  distutils2/tests/fake_dists/python-pager-readme.rst |  62 ----------
  distutils2/tests/test_command_register.py           |  15 +-
  3 files changed, 10 insertions(+), 71 deletions(-)


diff --git a/distutils2/metadata.py b/distutils2/metadata.py
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -36,7 +36,7 @@
         def system_message(self, level, message, *children, **kwargs):
             self.messages.append((level, message, children, kwargs))
             return nodes.system_message(message, level=level, type=self.
-                    levels[level], *children, **kwargs)
+                                        levels[level], *children, **kwargs)
 
 
     _HAS_DOCUTILS = True
@@ -279,7 +279,7 @@
         document.note_source(source_path, -1)
         try:
             parser.parse(data, document)
-        except (AttributeError, TypeError):
+        except AttributeError:
             reporter.messages.append((-1, 'Could not finish the parsing.',
                                       '', {}))
 
diff --git a/distutils2/tests/fake_dists/python-pager-readme.rst b/distutils2/tests/fake_dists/python-pager-readme.rst
deleted file mode 100644
--- a/distutils2/tests/fake_dists/python-pager-readme.rst
+++ /dev/null
@@ -1,65 +0,0 @@
-
-Python module to page screen output and get dimensions
-of available console space.
-
-It is meant to be finally included into standard library
-http://bugs.python.org/issue8408
-
-| Author:  anatoly techtonik <techtonik at gmail.com>
-| License: Public Domain (or MIT if a license is required)
-
-
-Status
-------
-
-0.1 (stable)
- - shows content page by page
- - allows to get console/terminal dimensions
- - works on Windows
- - works on Linux
-
-
-API
----
-
-..function:: getwidth()
-
-  Return width of available window in characters.  If detection fails,
-  return value of standard width 80.  Coordinate of the last character
-  on a line is -1 from returned value. 
-
-
-..function:: getheight()
-
-  Return available window height in characters or 25 if detection fails.
-  Coordinate of the last line is -1 from returned value. 
-
-
-..function:: getch()
-
-  Wait for keypress and return character in a cross-platform way.
-  Credits: Danny Yoo, Python Cookbook
-
-
-..function:: page(content, [pagecallback=prompt])
-
-  Output `content` iterable, calling `pagecallback` function after each
-  page. Default :func:`prompt` callback shows 'Press any key . . . ' prompt
-  and waits for keypress.
-
-
-References
-----------
-
-Excellent tutorials for Win32 Console by Adrian Worley
-http://www.adrianxw.dk/SoftwareSite/index.html
-Console Reference on MSDN
-http://msdn.microsoft.com/en-us/library/ms682087%28VS.85%29.aspx
-
-Public Domain Curses library maintained by William McBrine
-http://pdcurses.sourceforge.net/
-
-Ioctl (input/output control) introduction from Wikipedia
-http://en.wikipedia.org/wiki/Ioctl
-Linux Programmer's Manual - ioctls for terminals and serial lines
-http://www.kernel.org/doc/man-pages/online/pages/man4/tty_ioctl.4.html
diff --git a/distutils2/tests/test_command_register.py b/distutils2/tests/test_command_register.py
--- a/distutils2/tests/test_command_register.py
+++ b/distutils2/tests/test_command_register.py
@@ -10,7 +10,7 @@
     DOCUTILS_SUPPORT = False
 
 from distutils2.tests import unittest, support
-from distutils2.tests.support import Inputs
+from distutils2.tests.support import (Inputs, requires_docutils)
 from distutils2.command import register as register_module
 from distutils2.command.register import register
 from distutils2.errors import PackagingSetupError
@@ -253,12 +253,10 @@
         self.assertEqual(data['metadata_version'], '1.2')
         self.assertEqual(data['requires_dist'], ['lxml'])
 
+    @requires_docutils
     def test_register_invalid_long_description(self):
-        readme_file = os.path.join(os.path.dirname(__file__),
-                'fake_dists', 'python-pager-readme.rst')
-
-        # Contains :func: which break the rst format 
-        data = "".join(open(readme_file).readlines())
+        # Contains :func: which break the rst format
+        data = "Default :func:`prompt` callback shows"
 
         metadata = {'Home-page': 'xxx', 'Author': 'xxx',
                     'Author-email': 'xxx',
@@ -270,7 +268,10 @@
         cmd.strict = True
         inputs = Inputs('2', 'tarek', 'tarek at ziade.org')
         register_module.raw_input = inputs
-        self.assertRaises(PackagingSetupError, cmd.run)
+        with self.assertRaises(PackagingSetupError) as e:
+            cmd.run()
+        self.assertIsNotNone(e)
+        self.assertIn('func', repr(e.exception))
 
 def test_suite():
     return unittest.makeSuite(RegisterTestCase)

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list