[Python-checkins] r79630 - in python/trunk/Lib/unittest: result.py test/test_result.py

michael.foord python-checkins at python.org
Sat Apr 3 00:30:57 CEST 2010


Author: michael.foord
Date: Sat Apr  3 00:30:56 2010
New Revision: 79630

Log:
unittest tests no longer replace the sys.stdout put in place by regrtest

Modified:
   python/trunk/Lib/unittest/result.py
   python/trunk/Lib/unittest/test/test_result.py

Modified: python/trunk/Lib/unittest/result.py
==============================================================================
--- python/trunk/Lib/unittest/result.py	(original)
+++ python/trunk/Lib/unittest/result.py	Sat Apr  3 00:30:56 2010
@@ -19,10 +19,6 @@
         return method(self, *args, **kw)
     return inner
 
-
-_std_out = sys.stdout
-_std_err = sys.stderr
-
 NEWLINE = os.linesep
 STDOUT_LINE = '%sStdout:%s%%s' % (NEWLINE, NEWLINE)
 STDERR_LINE = '%sStderr:%s%%s' % (NEWLINE, NEWLINE)
@@ -89,8 +85,8 @@
                         error += NEWLINE
                     self._original_stderr.write(STDERR_LINE % error)
 
-            sys.stdout = _std_out
-            sys.stderr = _std_err
+            sys.stdout = self._original_stdout
+            sys.stderr = self._original_stderr
             self._stdout_buffer.seek(0)
             self._stdout_buffer.truncate()
             self._stderr_buffer.seek(0)

Modified: python/trunk/Lib/unittest/test/test_result.py
==============================================================================
--- python/trunk/Lib/unittest/test/test_result.py	(original)
+++ python/trunk/Lib/unittest/test/test_result.py	Sat Apr  3 00:30:56 2010
@@ -422,8 +422,8 @@
         result.addSuccess(self)
         result.stopTest(self)
 
-        self.assertIs(real_out, sys.stdout)
-        self.assertIs(real_err, sys.stderr)
+        self.assertIs(sys.stdout, result._original_stdout)
+        self.assertIs(sys.stderr, result._original_stderr)
 
         self.assertEqual(result._original_stdout.getvalue(), '')
         self.assertEqual(result._original_stderr.getvalue(), '')


More information about the Python-checkins mailing list