Author: bugman Date: Fri Jan 4 17:39:20 2008 New Revision: 4327 URL: http://svn.gna.org/viewcvs/relax?rev=4327&view=rev Log: Created the _RelaxTestResult class as a replacement for _TextTestResult. This is where the capture of STDOUT should occur. Modified: 1.3/test_suite/relax_test_runner.py Modified: 1.3/test_suite/relax_test_runner.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/relax_test_runner.py?rev=4327&r1=4326&r2=4327&view=diff ============================================================================== --- 1.3/test_suite/relax_test_runner.py (original) +++ 1.3/test_suite/relax_test_runner.py Fri Jan 4 17:39:20 2008 @@ -22,11 +22,19 @@ # Python module imports. import sys -from unittest import TextTestRunner +from unittest import _TextTestResult, TextTestRunner try: from cStringIO import StringIO except ImportError: from StringIO import StringIO + + +class _RelaxTestResult(_TextTestResult): + """A replacement for the _TextTestResult class used by the normal TextTestRunner. + + This class is designed to catch STDOUT during the execution of each test and to prepend the + output to the failure and error reports normally generated by TextTestRunner. + """ class RelaxTestRunner(TextTestRunner): @@ -35,6 +43,13 @@ This runner is designed to catch STDOUT during the execution of each test and to prepend the output to the failure and error reports normally generated by TextTestRunner. """ + + def _makeResult(self): + """Override of the TextTestRunner._makeResult() method.""" + + # Run the tests. + return _RelaxTestResult(self.stream, self.descriptions, self.verbosity) + def run(self, test): """Override of the TextTestRunner.run() method."""