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,
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:
......
......@@ -1020,7 +1020,7 @@ def check_impl_detail(**guards):
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()
......
......@@ -1198,6 +1198,9 @@ Documentation
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.
......
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