Author: bugman Date: Wed Oct 5 15:21:26 2011 New Revision: 14788 URL: http://svn.gna.org/viewcvs/relax?rev=14788&view=rev Log: The unittest _TextTestResult object is now depreciated! All instances of _TextTestResult have been replaced by TextTestResult. 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=14788&r1=14787&r2=14788&view=diff ============================================================================== --- 1.3/test_suite/relax_test_runner.py (original) +++ 1.3/test_suite/relax_test_runner.py Wed Oct 5 15:21:26 2011 @@ -22,7 +22,7 @@ # Python module imports. import sys -from unittest import _TextTestResult, TextTestRunner +from unittest import TextTestResult, TextTestRunner try: from cStringIO import StringIO except ImportError: @@ -32,15 +32,15 @@ from status import Status; status = Status() -class _RelaxTestResult(_TextTestResult): - """A replacement for the _TextTestResult class used by the normal TextTestRunner. +class RelaxTestResult(TextTestResult): + """A replacement for the TextTestResult class. This class is designed to catch STDOUT and STDERR during the execution of each test and to prepend the output to the failure and error reports normally generated by TextTestRunner. """ def startTest(self, test): - """Override of the _TextTestResult.startTest() method. + """Override of the TextTestResult.startTest() method. The start of STDOUT and STDERR capture occurs here. """ @@ -59,11 +59,11 @@ status.exec_lock.test_name = str(test) # Execute the normal startTest method. - _TextTestResult.startTest(self, test) + TextTestResult.startTest(self, test) def stopTest(self, test): - """Override of the _TextTestResult.stopTest() method. + """Override of the TextTestResult.stopTest() method. The end of STDOUT and STDERR capture occurs here. """ @@ -80,7 +80,7 @@ """ # Execute the normal addError method. - _TextTestResult.addError(self, test, err) + TextTestResult.addError(self, test, err) # Prepend the STDOUT and STDERR messages to the second element of the tuple. self.errors[-1] = (self.errors[-1][0], self.capt.getvalue() + self.errors[-1][1]) @@ -93,7 +93,7 @@ """ # Execute the normal addFailure method. - _TextTestResult.addFailure(self, test, err) + TextTestResult.addFailure(self, test, err) # Prepend the STDOUT and STDERR messages to the second element of the tuple. self.failures[-1] = (self.failures[-1][0], self.capt.getvalue() + self.failures[-1][1]) @@ -112,4 +112,4 @@ """Override of the TextTestRunner._makeResult() method.""" # Run the tests. - return _RelaxTestResult(self.stream, self.descriptions, self.verbosity) + return RelaxTestResult(self.stream, self.descriptions, self.verbosity)