summaryrefslogtreecommitdiff
path: root/tests/test_highlighting.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-02-06 22:18:16 +0100
committerGeorg Brandl <georg@python.org>2009-02-06 22:18:16 +0100
commit522308f342b09a297981f4b3377aecd5f67a5d47 (patch)
tree881c6ca7e50a792a37c56ce55eac80f5369672c8 /tests/test_highlighting.py
parent376ef7c9cb923f0922b4510670110c5423ce8b6e (diff)
downloadsphinx-522308f342b09a297981f4b3377aecd5f67a5d47.tar.gz
Skip pygments-related tests if it is not installed.
Diffstat (limited to 'tests/test_highlighting.py')
-rw-r--r--tests/test_highlighting.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/test_highlighting.py b/tests/test_highlighting.py
index 198f7a0a..ea1f25f1 100644
--- a/tests/test_highlighting.py
+++ b/tests/test_highlighting.py
@@ -11,6 +11,12 @@
from util import *
+try:
+ import pygments
+except ImportError:
+ from nose.plugins.skip import SkipTest
+ raise SkipTest('pygments not available')
+
from pygments.lexer import RegexLexer
from pygments.token import Text, Name
from pygments.formatters.html import HtmlFormatter
@@ -28,16 +34,17 @@ class MyLexer(RegexLexer):
],
}
-class ComplainOnUnhighlighted(PygmentsBridge):
-
- def unhighlighted(self, source):
- raise AssertionError("should highlight %r" % source)
class MyFormatter(HtmlFormatter):
def format(self, tokensource, outfile):
outfile.write('test')
+class ComplainOnUnhighlighted(PygmentsBridge):
+ def unhighlighted(self, source):
+ raise AssertionError("should highlight %r" % source)
+
+
@with_app()
def test_add_lexer(app):
app.add_lexer('test', MyLexer())