Skip to content

Commit

Permalink
Simplify explosive error avoidance
Browse files Browse the repository at this point in the history
We still don't want to mess around with handle_layer_failure on
MemoryError, because it's unlikely to help; but the other two exception
types listed as "explosive errors" were KeyboardInterrupt and
SystemExit, which inherit from BaseException rather than Exception, so
there's no need to catch and re-raise them before catching Exception.
  • Loading branch information
cjwatson committed Oct 12, 2019
1 parent d1a9838 commit acedb19
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/zope/testrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class UnexpectedSuccess(Exception):
pass


EXPLOSIVE_ERRORS = (MemoryError, KeyboardInterrupt, SystemExit)
PYREFCOUNT_PATTERN = re.compile(r'\[[0-9]+ refs\]')

is_jython = sys.platform.startswith('java')
Expand Down Expand Up @@ -463,7 +462,7 @@ def run_layer(options, layer_name, layer, tests, setup_layers,
setup_layer(options, layer, setup_layers)
except zope.testrunner.interfaces.EndRun:
raise
except EXPLOSIVE_ERRORS:
except MemoryError:
raise
except Exception:
handle_layer_failure(SetUpLayerFailure(layer), output, errors)
Expand Down Expand Up @@ -793,7 +792,7 @@ def tear_down_unneeded(options, needed, setup_layers, errors, optional=False):
output.tear_down_not_supported()
if not optional:
raise CanNotTearDown(l)
except EXPLOSIVE_ERRORS:
except MemoryError:
raise
except Exception:
handle_layer_failure(TearDownLayerFailure(l), output, errors)
Expand Down Expand Up @@ -821,7 +820,7 @@ def setup_layer(options, layer, setup_layers):
if hasattr(layer, 'setUp'):
try:
layer.setUp()
except EXPLOSIVE_ERRORS:
except MemoryError:
raise
except Exception:
if options.post_mortem:
Expand Down

0 comments on commit acedb19

Please sign in to comment.