diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-25 19:14:18 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-25 19:14:18 -0500 |
commit | 2d124b93708636179f5c611eb698ac68901c5931 (patch) | |
tree | c9a8f8307b9d06c803ad992234736e2a4e1d9a8a /coverage/misc.py | |
parent | 0c2166d7f7a438f3c35f30ebdaf0bf5ee8ed91b7 (diff) | |
download | python-coveragepy-git-2d124b93708636179f5c611eb698ac68901c5931.tar.gz |
Use a metaclass to convert StopEverything to SkipTest
Diffstat (limited to 'coverage/misc.py')
-rw-r--r-- | coverage/misc.py | 11 |
1 files changed, 3 insertions, 8 deletions
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 |