summaryrefslogtreecommitdiff
path: root/coverage/misc.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-01-19 22:19:21 -0500
committerNed Batchelder <ned@nedbatchelder.com>2017-01-19 22:19:21 -0500
commitd7f81d9bc278f23f801b38889708f180a8236127 (patch)
tree26f41aa7ba6aaadc637b63af7140141f22383c55 /coverage/misc.py
parent25265320746d58be23d3bed7ebe28b20c22cb9fa (diff)
downloadpython-coveragepy-d7f81d9bc278f23f801b38889708f180a8236127.tar.gz
A better way to deal with StopEverything exceptions
Diffstat (limited to 'coverage/misc.py')
-rw-r--r--coverage/misc.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index cb9248d..d3723e2 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -255,8 +255,13 @@ class SimpleRepr(object):
)
-class CoverageException(Exception):
- """An exception specific to coverage.py."""
+class BaseCoverageException(Exception):
+ """The base of all Coverage exceptions."""
+ pass
+
+
+class CoverageException(BaseCoverageException):
+ """A run-of-the-mill exception specific to coverage.py."""
pass
@@ -298,6 +303,11 @@ class StopEverything(getattr(unittest, 'SkipTest', Exception)):
pass
-class IncapablePython(CoverageException, StopEverything):
- """An operation is attempted that this version of Python cannot do."""
+class IncapablePython(BaseCoverageException, StopEverything):
+ """An operation is attempted that this version of Python cannot do.
+
+ This is derived from BaseCoverageException, not CoverageException, so that
+ it won't get caught by 'except CoverageException'.
+
+ """
pass