[Python-checkins] r80694 - in python/branches/py3k: Lib/test/regrtest.py Lib/test/support.py Misc/NEWS

victor.stinner python-checkins at python.org
Sun May 2 11:37:08 CEST 2010


Author: victor.stinner
Date: Sun May  2 11:37:08 2010
New Revision: 80694

Log:
Issue #8533: Write tracebacks and failed tests to sys.stderr instead of
sys.stdout to avoid UnicodeEncodeError (use backslashreplace error handler)


Modified:
   python/branches/py3k/Lib/test/regrtest.py
   python/branches/py3k/Lib/test/support.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Sun May  2 11:37:08 2010
@@ -939,8 +939,8 @@
         print("test", test, "crashed --", str(type) + ":", value)
         sys.stdout.flush()
         if verbose or debug:
-            traceback.print_exc(file=sys.stdout)
-            sys.stdout.flush()
+            traceback.print_exc(file=sys.stderr)
+            sys.stderr.flush()
         return FAILED, test_time
     else:
         if refleak:

Modified: python/branches/py3k/Lib/test/support.py
==============================================================================
--- python/branches/py3k/Lib/test/support.py	(original)
+++ python/branches/py3k/Lib/test/support.py	Sun May  2 11:37:08 2010
@@ -1020,7 +1020,7 @@
 def _run_suite(suite):
     """Run tests from a unittest.TestSuite-derived class."""
     if verbose:
-        runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
+        runner = unittest.TextTestRunner(sys.stderr, verbosity=2)
     else:
         runner = BasicTestRunner()
 

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun May  2 11:37:08 2010
@@ -1198,6 +1198,9 @@
 Tests
 -----
 
+- Issue #8533: Write tracebacks and failed tests to sys.stderr instead of
+  sys.stdout to avoid UnicodeEncodeError (use backslashreplace error handler)
+
 - Issue #8576: Remove use of find_unused_port() in test_smtplib and
   test_multiprocessing.  Patch by Paul Moore.
 


More information about the Python-checkins mailing list