Commits

Anonymous committed 942ecbb

Ignore import errors in the tests.

  • Participants
  • Parent commits 213ac47
  • Branches trunk
  • Tags 0.10

Comments (0)

Files changed (2)

File pygments/formatters/img.py

 DEFAULT_FONT_NAME_WIN = 'Courier New'
 
 
-class PilNotAvailable(Exception):
+class PilNotAvailable(ImportError):
     """When Python imaging library is not available"""
 
 

File tests/test_basic_api.py

             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)
 
         # 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)