tests: use unittest.SkipTest
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 03 Jun 2017 17:04:42 -0700
changeset 32932 240183a04429
parent 32931 b08431e1b062
child 32933 f83b7376a300
tests: use unittest.SkipTest unittest.SkipTest was introduced in Python 2.7. We previously defined it with our own class so we could run on Python 2.6.
tests/run-tests.py
--- a/tests/run-tests.py	Thu Jun 15 23:23:47 2017 -0700
+++ b/tests/run-tests.py	Sat Jun 03 17:04:42 2017 -0700
@@ -711,7 +711,7 @@
             except KeyboardInterrupt:
                 self._aborted = True
                 raise
-            except SkipTest as e:
+            except unittest.SkipTest as e:
                 result.addSkip(self, str(e))
                 # The base class will have already counted this as a
                 # test we "ran", but we want to exclude skipped tests
@@ -789,7 +789,7 @@
                 self.fail('hg have failed checking for %s' % failed[-1])
             else:
                 self._skipped = True
-                raise SkipTest(missing[-1])
+                raise unittest.SkipTest(missing[-1])
         elif ret == 'timeout':
             self.fail('timed out')
         elif ret is False:
@@ -847,7 +847,7 @@
 
     def _run(self, env):
         # This should be implemented in child classes to run tests.
-        raise SkipTest('unknown test type')
+        raise unittest.SkipTest('unknown test type')
 
     def abort(self):
         """Terminate execution of this test."""
@@ -1486,9 +1486,6 @@
 
 iolock = threading.RLock()
 
-class SkipTest(Exception):
-    """Raised to indicate that a test is to be skipped."""
-
 class IgnoreTest(Exception):
     """Raised to indicate that a test is to be ignored."""