Author: julien
Date: 2012-03-15 17:36:52 -0700 (Thu, 15 Mar 2012)
New Revision: 17749

Modified:
   django/trunk/django/contrib/markup/tests.py
Log:
Fixed #17908 -- Made some `contrib.markup` tests be skipped so they don't fail 
on old versions of Markdown. Thanks to Preston Holmes for the patch.

Modified: django/trunk/django/contrib/markup/tests.py
===================================================================
--- django/trunk/django/contrib/markup/tests.py 2012-03-16 00:32:42 UTC (rev 
17748)
+++ django/trunk/django/contrib/markup/tests.py 2012-03-16 00:36:52 UTC (rev 
17749)
@@ -12,6 +12,7 @@
 
 try:
     import markdown
+    markdown_version = getattr(markdown, "version_info", 0)
 except ImportError:
     markdown = None
 
@@ -36,7 +37,6 @@
 
 .. _link: http://www.example.com/""";
 
-
     @unittest.skipUnless(textile, 'texttile not installed')
     def test_textile(self):
         t = Template("{% load markup %}{{ textile_content|textile }}")
@@ -58,14 +58,14 @@
         pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""")
         self.assertTrue(pattern.match(rendered))
 
-    @unittest.skipUnless(markdown, 'markdown no installed')
+    @unittest.skipUnless(markdown and markdown_version >= (2,1), 'markdown >= 
2.1 not installed')
     def test_markdown_attribute_disable(self):
         t = Template("{% load markup %}{{ markdown_content|markdown:'safe' }}")
         markdown_content = "{@onclick=alert('hi')}some paragraph"
         rendered = 
t.render(Context({'markdown_content':markdown_content})).strip()
         self.assertTrue('@' in rendered)
 
-    @unittest.skipUnless(markdown, 'markdown no installed')
+    @unittest.skipUnless(markdown and markdown_version >= (2,1), 'markdown >= 
2.1 not installed')
     def test_markdown_attribute_enable(self):
         t = Template("{% load markup %}{{ markdown_content|markdown }}")
         markdown_content = "{@onclick=alert('hi')}some paragraph"

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to