support.verbose = verbose # Tell tests to be moderately quiet
support.use_resources = use_resources
save_modules = sys.modules.keys()
+ replace_stdout()
for test in tests:
if not quiet:
print(test)
tests.sort()
return stdtests + tests
+def replace_stdout():
+ """Set stdout encoder error handler to backslashreplace (as stderr error
+ handler) to avoid UnicodeEncodeError when printing a traceback"""
+ stdout = sys.stdout
+ sys.stdout = open(stdout.fileno(), 'w',
+ encoding=stdout.encoding,
+ errors="backslashreplace")
+
def runtest(test, generate, verbose, quiet, test_times,
testdir=None, huntrleaks=False, debug=False):
"""Run a single test.
Tests
-----
+- Issue #8533: regrtest uses backslashreplace error handler for stdout to avoid
+ UnicodeEncodeError (write non-ASCII character to stdout using ASCII encoding)
+
- Issue #8576: Remove use of find_unused_port() in test_smtplib and
test_multiprocessing. Patch by Paul Moore.