summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-01-21 15:19:26 -0500
committerNed Batchelder <ned@nedbatchelder.com>2017-01-21 15:19:26 -0500
commit7920662665c20e39d3a470859ec6e7d322607602 (patch)
tree625d65a2f9c17f04e79e91a76a6f75f132055825
parent19483399663fb9a78b012998a9e4be16176db707 (diff)
downloadpython-coveragepy-git-7920662665c20e39d3a470859ec6e7d322607602.tar.gz
One more tweak to StopEverything
-rw-r--r--coverage/misc.py12
-rw-r--r--coverage/parser.py4
2 files changed, 3 insertions, 13 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index d3723e29..8e14aec9 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -293,7 +293,7 @@ class ExceptionDuringRun(CoverageException):
# 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(getattr(unittest, 'SkipTest', Exception)):
+class StopEverything(BaseCoverageException, getattr(unittest, 'SkipTest', Exception)):
"""An exception that means everything should stop.
This derives from SkipTest so that tests that spring this trap will be
@@ -301,13 +301,3 @@ class StopEverything(getattr(unittest, 'SkipTest', Exception)):
"""
pass
-
-
-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
diff --git a/coverage/parser.py b/coverage/parser.py
index 6e9bd54a..ca6745f9 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -16,7 +16,7 @@ from coverage.backward import bytes_to_ints, string_class
from coverage.bytecode import CodeObjects
from coverage.debug import short_stack
from coverage.misc import contract, join_regex, new_contract, nice_pair, one_of
-from coverage.misc import NoSource, IncapablePython, NotPython
+from coverage.misc import NoSource, NotPython, StopEverything
from coverage.phystokens import compile_unicode, generate_tokens, neuter_encoding_declaration
@@ -373,7 +373,7 @@ class ByteParser(object):
# attributes on code objects that we need to do the analysis.
for attr in ['co_lnotab', 'co_firstlineno']:
if not hasattr(self.code, attr):
- raise IncapablePython( # pragma: only jython
+ raise StopEverything( # pragma: only jython
"This implementation of Python doesn't support code analysis.\n"
"Run coverage.py under another Python for this command."
)