From 2d124b93708636179f5c611eb698ac68901c5931 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 25 Jan 2017 19:14:18 -0500 Subject: Use a metaclass to convert StopEverything to SkipTest --- coverage/misc.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'coverage/misc.py') diff --git a/coverage/misc.py b/coverage/misc.py index 8e14aec9..9c4843ef 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -13,7 +13,6 @@ import types from coverage import env from coverage.backward import to_bytes, unicode_class -from coverage.backunittest import unittest ISOLATED_MODULES = {} @@ -289,15 +288,11 @@ class ExceptionDuringRun(CoverageException): pass -# unittest.SkipTest doesn't exist in Python 2.6. We backport it with -# unittest2 in the coverage.py test suite. But for production, we don't need -# to derive from SkipTest, so if it doesn't exist, just use Exception. - -class StopEverything(BaseCoverageException, getattr(unittest, 'SkipTest', Exception)): +class StopEverything(BaseCoverageException): """An exception that means everything should stop. - This derives from SkipTest so that tests that spring this trap will be - skipped automatically, without a lot of boilerplate all over the place. + The CoverageTest class converts these to SkipTest, so that when running + tests, raising this exception will automatically skip the test. """ pass -- cgit v1.2.1