From 2e627e3d0798abc1aad00d871cd7f2a32a286ced 2013-07-17 05:59:20
From: Paul Ivanov <pi@berkeley.edu>
Date: 2013-07-17 05:59:20
Subject: [PATCH] fix pywin32 error in tests for IPython.lib

---

diff --git a/IPython/testing/decorators.py b/IPython/testing/decorators.py
index 8be326e..68bede7 100644
--- a/IPython/testing/decorators.py
+++ b/IPython/testing/decorators.py
@@ -353,7 +353,14 @@ def onlyif_cmds_exist(*commands):
     Decorator to skip test when at least one of `commands` is not found.
     """
     for cmd in commands:
-        if not is_cmd_found(cmd):
-            return skip("This test runs only if command '{0}' "
-                        "is installed".format(cmd))
+        try:
+            if not is_cmd_found(cmd):
+                return skip("This test runs only if command '{0}' "
+                            "is installed".format(cmd))
+        except ImportError as e:
+            # is_cmd_found uses pywin32 on windows, which might not be available
+            if sys.platform == 'win32' and 'pywin32' in e.message:
+                return skip("This test runs only if pywin32 and command '{0}' "
+                            "is installed".format(cmd))
+            raise e
     return null_deco