/[gentoo-x86]/dev-python/markdown/files/markdown-2.2.0-tests.patch
Gentoo

Contents of /dev-python/markdown/files/markdown-2.2.0-tests.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sat Nov 10 12:19:15 2012 UTC (7 years, 9 months ago) by idella4
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-diff
Dropped version-2.0.3, bumped version-2.2.0, upstream patch fixes broken test, upstream issue #112, fixes Bug #437290

(Portage version: 2.1.11.30/cvs/Linux x86_64, unsigned Manifest commit)

1 https://github.com/waylan/Python-Markdown/issues/112
2 https://github.com/waylan/Python-Markdown/commit/5b3e724fb78da73ab87fb34e4ac9d9299773cfed
3
4 --- markdown/__init__.py
5 +++ markdown/__init__.py
6 @@ -37,6 +37,7 @@
7 import codecs
8 import sys
9 import logging
10 +import warnings
11 import util
12 from preprocessors import build_preprocessors
13 from blockprocessors import build_block_parser
14 @@ -163,10 +164,10 @@
15 if isinstance(ext, basestring):
16 ext = self.build_extension(ext, configs.get(ext, []))
17 if isinstance(ext, Extension):
18 - # might raise NotImplementedError, but that's the extension author's problem
19 ext.extendMarkdown(self, globals())
20 elif ext is not None:
21 - raise ValueError('Extension "%s.%s" must be of type: "markdown.Extension".' \
22 + raise TypeError(
23 + 'Extension "%s.%s" must be of type: "markdown.Extension"'
24 % (ext.__class__.__module__, ext.__class__.__name__))
25
26 return self
27 @@ -200,19 +201,22 @@
28 module_name_old_style = '_'.join(['mdx', ext_name])
29 try: # Old style (mdx_<extension>)
30 module = __import__(module_name_old_style)
31 - except ImportError:
32 - logger.warn("Failed loading extension '%s' from '%s' or '%s'"
33 - % (ext_name, module_name, module_name_old_style))
34 - # Return None so we don't try to initiate none-existant extension
35 - return None
36 + except ImportError, e:
37 + message = "Failed loading extension '%s' from '%s' or '%s'" \
38 + % (ext_name, module_name, module_name_old_style)
39 + e.args = (message,) + e.args[1:]
40 + raise
41
42 # If the module is loaded successfully, we expect it to define a
43 # function called makeExtension()
44 try:
45 return module.makeExtension(configs.items())
46 except AttributeError, e:
47 - logger.warn("Failed to initiate extension '%s': %s" % (ext_name, e))
48 - return None
49 + message = e.args[0]
50 + message = "Failed to initiate extension " \
51 + "'%s': %s" % (ext_name, message)
52 + e.args = (message,) + e.args[1:]
53 + raise
54
55 def registerExtension(self, extension):
56 """ This gets called by the extension """
57 --- tests/test_apis.py
58 +++ tests/test_apis.py
59 @@ -245,18 +245,18 @@
60
61 def testLoadExtensionFailure(self):
62 """ Test failure of an extension to load. """
63 - self.assertRaises(ValueError,
64 + self.assertRaises(ImportError,
65 markdown.Markdown, extensions=['non_existant_ext'])
66
67 def testLoadBadExtension(self):
68 """ Test loading of an Extension with no makeExtension function. """
69 _create_fake_extension(name='fake', has_factory_func=False)
70 - self.assertRaises(ValueError, markdown.Markdown, extensions=['fake'])
71 + self.assertRaises(AttributeError, markdown.Markdown, extensions=['fake'])
72
73 def testNonExtension(self):
74 """ Test loading a non Extension object as an extension. """
75 _create_fake_extension(name='fake', is_wrong_type=True)
76 - self.assertRaises(ValueError, markdown.Markdown, extensions=['fake'])
77 + self.assertRaises(TypeError, markdown.Markdown, extensions=['fake'])
78
79 def testBaseExtention(self):
80 """ Test that the base Extension class will raise NotImplemented. """

  ViewVC Help
Powered by ViewVC 1.1.20