Anonymous committed 942ecbb

Ignore import errors in the tests.

Comments (0)

Files changed (2)


-class PilNotAvailable(Exception):
+class PilNotAvailable(ImportError):
     """When Python imaging library is not available"""


             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.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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.