Trial swallows errors in result objects

[email protected] Sun, 06 Sep 2009 09:15:50 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from jml <[email protected]>:

The following script demonstrates that Trial doesn't report errors in test objects in any way.

{{{
#python
import unittest

from twisted.trial.unittest import TestCase


class BrokenResult(unittest.TestResult):

    def addFailure(self, test, failure):
        1/0


class FailingTest(TestCase):

    def test_foo(self):
        self.fail('No good reason')


if __name__ == '__main__':
    test = FailingTest('test_foo')
    result = BrokenResult()
    test.run(result)
    print result
}}}

If you run it, you'll see something like:

{{{
$ python swallow-error.py 
<__main__.BrokenResult run=1 errors=0 failures=0>
}}}

Instead, you should see some sort of error about the `1/0` line.


----------
Type     : defect
Component: trial
Keywords : 
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4003