Author: bugman Date: Fri Jan 4 17:44:32 2008 New Revision: 4328 URL: http://svn.gna.org/viewcvs/relax?rev=4328&view=rev Log: Shifted the STDOUT redirection into the startTest() and stopTest() methods.
These methods are overrides for those in TestResult and _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=4328&r1=4327&r2=4328&view=diff ============================================================================== --- 1.3/test_suite/relax_test_runner.py (original) +++ 1.3/test_suite/relax_test_runner.py Fri Jan 4 17:44:32 2008 @@ -36,6 +36,29 @@ output to the failure and error reports normally generated by TextTestRunner. """ + def startTest(self, test): + """Override of the _TextTestResult.startTest() method. + + The start of STDOUT capture occurs here. + """ + + # Catch stdout. + self.capt_stdout = StringIO() + sys.stdout = self.capt_stdout + + + def stopTest(self, test): + """Override of the TestResult.stopTest() method. + + The end of STDOUT capture occurs here. + """ + + # Restore stdout. + sys.stdout = sys.__stdout__ + + # Close the buffer. + self.capt_stdout.close() + class RelaxTestRunner(TextTestRunner): """A replacement unittest runner. @@ -51,18 +74,11 @@ return _RelaxTestResult(self.stream, self.descriptions, self.verbosity) - def run(self, test): + def run2(self, test): """Override of the TextTestRunner.run() method.""" - - # Catch stdout. - buf = StringIO() - sys.stdout = buf # Execute the normal run method. result = TextTestRunner.run(self, test) - - # Restore stdout. - sys.stdout = sys.__stdout__ #print "\n\n\n\n\n\n\n" #print dir(results) @@ -70,8 +86,5 @@ #print results.failures #print `buf.getvalue()` - # Close the buffer. - buf.close() - # Return the results object. return result _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits