Author: bugman Date: Mon Apr 21 14:20:14 2008 New Revision: 5914 URL: http://svn.gna.org/viewcvs/relax?rev=5914&view=rev Log: STDERR is now being caught by the relax test suite TextTestRunner replacement. 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=5914&r1=5913&r2=5914&view=diff ============================================================================== --- 1.3/test_suite/relax_test_runner.py (original) +++ 1.3/test_suite/relax_test_runner.py Mon Apr 21 14:20:14 2008 @@ -32,8 +32,8 @@ 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. + 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): @@ -45,6 +45,10 @@ # Catch stdout. self.capt_stdout = StringIO() sys.stdout = self.capt_stdout + + # Catch stderr. + self.capt_stderr = StringIO() + sys.stderr = self.capt_stderr # Execute the normal startTest method. _TextTestResult.startTest(self, test) @@ -69,6 +73,9 @@ # Execute the normal addError method. _TextTestResult.addError(self, test, err) + # Prepend STDERR to the second element of the tuple. + self.errors[-1] = (self.errors[-1][0], self.capt_stderr.getvalue() + self.errors[-1][1]) + # Prepend STDOUT to the second element of the tuple. self.errors[-1] = (self.errors[-1][0], self.capt_stdout.getvalue() + self.errors[-1][1])