It's a feature. If you want to override this, you'll need to subclass TestCase
and/or TestSuite
classes and override logic in the run()
method.
P.S.:
I think you have to subclass unittest.TestCase
and override method run()
in your class:
def run(self, result=None):
if result is None: result = self.defaultTestResult()
result.startTest(self)
testMethod = getattr(self, self._testMethodName)
try:
try:
self.setUp()
except KeyboardInterrupt:
raise
except:
result.addError(self, self._exc_info())
return
ok = False
try:
testMethod()
ok = True
except self.failureException:
result.addFailure(self, self._exc_info())
result.stop()
except KeyboardInterrupt:
raise
except:
result.addError(self, self._exc_info())
result.stop()
try:
self.tearDown()
except KeyboardInterrupt:
raise
except:
result.addError(self, self._exc_info())
ok = False
if ok: result.addSuccess(self)
finally:
result.stopTest(self)
(I've added two result.stop()
calls to the default run
definition).
Then you'll have to modify all your testcases to make them subclasses of this new class, instead of unittest.TestCase
.
WARNING: I didn't test this code. :)