bpo-45410: Enhance libregrtest -W/--verbose3 option (GH-28908)

libregrtest -W/--verbose3 now also replace sys.__stdout__,
sys.__stderr__, and stdout and stderr file descriptors (fd 1 and fd
2).

support.print_warning() messages are now logged in the expected
order.

The "./python -m test test_eintr -W" command no longer logs into
stdout if the test pass.
This commit is contained in:
Victor Stinner 2021-10-13 01:52:22 +02:00 committed by GitHub
parent 2d21612f0d
commit dbe213de7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 15 deletions

View file

@ -71,7 +71,7 @@ orig_unraisablehook = None
def regrtest_unraisable_hook(unraisable):
global orig_unraisablehook
support.environment_altered = True
print_warning("Unraisable exception")
support.print_warning("Unraisable exception")
old_stderr = sys.stderr
try:
support.flush_std_streams()
@ -94,7 +94,7 @@ orig_threading_excepthook = None
def regrtest_threading_excepthook(args):
global orig_threading_excepthook
support.environment_altered = True
print_warning(f"Uncaught thread exception: {args.exc_type.__name__}")
support.print_warning(f"Uncaught thread exception: {args.exc_type.__name__}")
old_stderr = sys.stderr
try:
support.flush_std_streams()