summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2012-03-16 00:38:18 +0000
committerJulien Phalip <jphalip@gmail.com>2012-03-16 00:38:18 +0000
commit2f6b8482f6a1117ac51efec675a7362f9b450349 (patch)
treeca19b52ffea2abf4d338fe187a7e946c8f573a43
parent838adb231254dfec5b1fd4b7588c2cd9593debc7 (diff)
downloaddjango-2f6b8482f6a1117ac51efec675a7362f9b450349.tar.gz
[1.3.X] 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.
Backport of r17749 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/markup/tests.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/contrib/markup/tests.py b/django/contrib/markup/tests.py
index 6903dd7d85..f970c286e2 100644
--- a/django/contrib/markup/tests.py
+++ b/django/contrib/markup/tests.py
@@ -14,6 +14,7 @@ except ImportError:
try:
import markdown
+ markdown_version = getattr(markdown, "version_info", 0)
except ImportError:
markdown = None
@@ -38,7 +39,6 @@ Paragraph 2 with a link_
.. _link: http://www.example.com/"""
-
@unittest.skipUnless(textile, 'texttile not installed')
def test_textile(self):
t = Template("{{ textile_content|textile }}")
@@ -60,14 +60,14 @@ Paragraph 2 with a link_
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"