Commit 0d80a587 authored by Victor Stinner's avatar Victor Stinner

Issue #8533: Write tracebacks and failed tests to sys.stderr instead of

sys.stdout to avoid UnicodeEncodeError (use backslashreplace error handler)
parent 70d8a86e
...@@ -939,8 +939,8 @@ def runtest_inner(test, verbose, quiet, ...@@ -939,8 +939,8 @@ def runtest_inner(test, verbose, quiet,
print("test", test, "crashed --", str(type) + ":", value) print("test", test, "crashed --", str(type) + ":", value)
sys.stdout.flush() sys.stdout.flush()
if verbose or debug: if verbose or debug:
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stderr)
sys.stdout.flush() sys.stderr.flush()
return FAILED, test_time return FAILED, test_time
else: else:
if refleak: if refleak:
......
...@@ -1020,7 +1020,7 @@ def check_impl_detail(**guards): ...@@ -1020,7 +1020,7 @@ def check_impl_detail(**guards):
def _run_suite(suite): def _run_suite(suite):
"""Run tests from a unittest.TestSuite-derived class.""" """Run tests from a unittest.TestSuite-derived class."""
if verbose: if verbose:
runner = unittest.TextTestRunner(sys.stdout, verbosity=2) runner = unittest.TextTestRunner(sys.stderr, verbosity=2)
else: else:
runner = BasicTestRunner() runner = BasicTestRunner()
......
...@@ -1198,6 +1198,9 @@ Documentation ...@@ -1198,6 +1198,9 @@ Documentation
Tests 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 - Issue #8576: Remove use of find_unused_port() in test_smtplib and
test_multiprocessing. Patch by Paul Moore. test_multiprocessing. Patch by Paul Moore.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment