From 49e7f4a229d8acf5920560987d6cd843c15df534 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Fri, 16 Mar 2012 00:36:52 +0000 Subject: [PATCH] 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. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17749 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/markup/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/contrib/markup/tests.py b/django/contrib/markup/tests.py index 4539657bd4..cccb5c8e85 100644 --- a/django/contrib/markup/tests.py +++ b/django/contrib/markup/tests.py @@ -12,6 +12,7 @@ except ImportError: try: import markdown + markdown_version = getattr(markdown, "version_info", 0) except ImportError: markdown = None @@ -36,7 +37,6 @@ Paragraph 2 with a link_ .. _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 @@ Paragraph 2 with a link_ pattern = re.compile("""

Paragraph 1\s*

\s*

\s*An 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"