diff options
author | gbrandl <devnull@localhost> | 2008-05-06 18:33:08 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-05-06 18:33:08 +0200 |
commit | e1627ab35dac49ccab3bb22f3f9a6fe65de8673c (patch) | |
tree | 2a6701c477c8ec706fec50cdc3f92d745aa035d0 | |
parent | addfe89328e28a0cd6305d236a8988726022ac46 (diff) | |
download | pygments-0.10.tar.gz |
Ignore import errors in the tests.0.10
-rw-r--r-- | pygments/formatters/img.py | 2 | ||||
-rw-r--r-- | tests/test_basic_api.py | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py index 96665122..0b5831b2 100644 --- a/pygments/formatters/img.py +++ b/pygments/formatters/img.py @@ -43,7 +43,7 @@ DEFAULT_FONT_NAME_NIX = 'Bitstream Vera Sans Mono' DEFAULT_FONT_NAME_WIN = 'Courier New' -class PilNotAvailable(Exception): +class PilNotAvailable(ImportError): """When Python imaging library is not available""" diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 0bcbb938..ab348cbc 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -131,7 +131,10 @@ class FormattersTest(unittest.TestCase): a(info[1], "missing formatter aliases") # aliases a(info[3], "missing formatter docstring") # doc - inst = formatter(opt1="val1") + try: + inst = formatter(opt1="val1") + except ImportError: + continue inst.get_style_defs() inst.format(ts, out) @@ -163,7 +166,11 @@ class FormattersTest(unittest.TestCase): # test that the formatter supports encoding and Unicode tokens = list(lexers.PythonLexer(encoding='utf-8').get_tokens("def f(): 'รค'")) for formatter, info in formatters.FORMATTERS.iteritems(): - inst = formatter(encoding=None) + try: + inst = formatter(encoding=None) + except ImportError: + # some dependency not installed + continue out = format(tokens, inst) if formatter.unicodeoutput: self.assert_(type(out) is unicode) |