Commit 7dcc6c30 authored by Julien Muchembled's avatar Julien Muchembled

Exit status for an interrupted test should not be 0

Also display traceback of interrupt.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35435 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f0133943
......@@ -91,6 +91,12 @@ def expectedFailure(func):
wrapper.__doc__ = func.__doc__
return wrapper
try:
BaseException
except NameError:
# BACK: python < 2.5
BaseException = Exception
class TestCase(unittest.TestCase):
"""We redefine here the run() method, and add a skipTest() method.
......@@ -136,10 +142,10 @@ class TestCase(unittest.TestCase):
result.addSkip(self, str(e))
except SetupSiteError, e:
result.errors.append(None)
except (KeyboardInterrupt, SystemExit): # BACK: Not needed for
raise # Python >= 2.5
except Exception:
except BaseException, e:
result.addError(self, sys.exc_info())
if isinstance(e, (KeyboardInterrupt, SystemExit)):
raise
else:
try:
testMethod()
......@@ -151,19 +157,19 @@ class TestCase(unittest.TestCase):
result.addUnexpectedSuccess(self)
except SkipTest, e:
result.addSkip(self, str(e))
except (KeyboardInterrupt, SystemExit): # BACK: Not needed for
raise # Python >= 2.5
except Exception:
except BaseException, e:
result.addError(self, sys.exc_info())
if isinstance(e, (KeyboardInterrupt, SystemExit)):
raise
else:
success = True
try:
self.tearDown()
except (KeyboardInterrupt, SystemExit): # BACK: Not needed for
raise # Python >= 2.5
except Exception:
except BaseException, e:
result.addError(self, sys.exc_info())
if isinstance(e, (KeyboardInterrupt, SystemExit)):
raise
success = False
# BACK: Not needed for Python < 2.7
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment