Getting Extended Error Information

bala blk at srasys.co.in
Fri Dec 5 07:21:08 CET 2003


Hi,I Need Clear Explanaiation of this below code...Bcos my requirement is similar to the below codeI found this code example code in this link http://www.python.org/doc/lib/unittest-error-info.htmlrunner is not returning the MyTestResult class object, instead it is returning the TestResult Class object.import unittest

class MyTestCase(unittest.TestCase):
    def defaultTestResult(self):
        return MyTestResult()

class MyTestResult(unittest.TestResult):
    def __init__(self):
        self.errors_tb = []
        self.failures_tb = []

    def addError(self, test, err):
        self.errors_tb.append((test, err))
        unittest.TestResult.addError(self, test, err)

    def addFailure(self, test, err):
        self.failures_tb.append((test, err))
        unittest.TestResult.addFailure(self, test, err)
suite = unittest.TestSuite()suite.addTest(unittest.makeSuite(MyTestCase))result = unittest.TextTestRunner(verbosity=2).run(suite)if you run this code,defaultTestResult(self) method not get called....Pls tell me how to extract the error information from MyTestResult classI will be thankfull to you...if u give a solution for the above problem.RegardsBala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20031205/d7719fb6/attachment.html>


More information about the Python-list mailing list