Use unittest2.skipIf decorator for some of the tests.

This commit is contained in:
Jannis Leidel
2011-04-19 14:50:45 +02:00
parent eaeaeb5d18
commit 2961cd1f7a

View File

@@ -1,6 +1,8 @@
import os
import re
import socket
from unittest2 import skipIf
from BeautifulSoup import BeautifulSoup
try:
@@ -134,7 +136,6 @@ class CompressorTestCase(TestCase):
finally:
settings.COMPRESS_OUTPUT_DIR = old_output_dir
if lxml:
class LxmlCompressorTestCase(CompressorTestCase):
def test_css_split(self):
@@ -154,8 +155,9 @@ if lxml:
def tearDown(self):
settings.COMPRESS_PARSER = self.old_parser
LxmlCompressorTestCase = skipIf(lxml is None, 'lxml not found')(LxmlCompressorTestCase)
if html5lib:
class Html5LibCompressorTesCase(CompressorTestCase):
def test_css_split(self):
@@ -183,6 +185,8 @@ if html5lib:
def tearDown(self):
settings.COMPRESS_PARSER = self.old_parser
Html5LibCompressorTesCase = skipIf(html5lib is None, 'html5lib not found')(Html5LibCompressorTesCase)
class CssAbsolutizingTestCase(TestCase):
def setUp(self):
@@ -454,10 +458,7 @@ class OfflineGenerationTestCase(TestCase):
settings.COMPRESS_OFFLINE_CONTEXT = self._old_offline_context
if find_command(settings.COMPRESS_CSSTIDY_BINARY):
class CssTidyTestCase(TestCase):
def test_tidy(self):
content = """
/* Some comment */
@@ -468,3 +469,8 @@ font,th,td,p{
from compressor.filters.csstidy import CSSTidyFilter
self.assertEqual(
"font,th,td,p{color:#000;}", CSSTidyFilter(content).output())
CssTidyTestCase = skipIf(
find_command(settings.COMPRESS_CSSTIDY_BINARY) is None,
'CSStidy binary %r not found' % settings.COMPRESS_CSSTIDY_BINARY
)(CssTidyTestCase)