changeset 727:e830b592917b

tests: fix test skipping in pure unittest
author Augie Fackler <durin42@gmail.com>
date Fri, 08 Oct 2010 13:58:26 -0500
parents 8d36054b04ed
children cfefeefad199
files tests/run.py tests/test_util.py
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run.py
+++ b/tests/run.py
@@ -3,6 +3,9 @@ import os
 import sys
 import unittest
 
+import test_util
+test_util.SkipTest = None
+
 def tests():
     import test_binaryfiles
     import test_diff
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -100,15 +100,17 @@ FIXTURES = os.path.join(os.path.abspath(
 
 
 def _makeskip(name, message):
-    def skip(*args, **kwargs):
-        raise SkipTest(message)
-    skip.__name__ = name
-    return skip
-
+    if SkipTest:
+        def skip(*args, **kwargs):
+            raise SkipTest(message)
+        skip.__name__ = name
+        return skip
 
 def requiresmodule(mod):
     """Skip a test if the specified module is not None."""
     def decorator(fn):
+        if fn is None:
+            return
         if mod is not None:
             return fn
         return _makeskip(fn.__name__, 'missing required feature')