diff tests/test_util.py @ 1458:dcf9eff9b5b7

tests: drop unittest2 Mixed using unittest2.SkipTest and unittest.TestCase will cause skips result in errors. We are probably not going to rewriting every "unittest.TestCase" to "unittest2.TestCase", then unittest2 is causing more trouble with little benefit. Let's drop it. To remain support for Py 26 in run.py, a simple loader.discover is added.
author Jun Wu <quark@fb.com>
date Thu, 16 Jun 2016 04:54:51 +0100
parents 019c3e194fba
children 7dc5c4368837
line wrap: on
line diff
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -39,13 +39,10 @@ except ImportError:
 try:
     SkipTest = unittest.SkipTest
 except AttributeError:
-    try:
-        from unittest2 import SkipTest
-    except ImportError:
-        try:
-            from nose import SkipTest
-        except ImportError:
-            SkipTest = None
+    if 'nose' in sys.modules:
+        SkipTest = sys.modules['nose'].SkipTest
+    else:
+        SkipTest = None
 
 from hgsubversion import svnwrap
 from hgsubversion import util