bpo-39983: Add test.support.print_warning() (GH-19683) (GH-19687)
Log "Warning -- ..." test warnings into sys.__stderr__ rather than
sys.stderr, to ensure to display them even if sys.stderr is captured.
test.libregrtest.utils.print_warning() now calls
test.support.print_warning().
(cherry picked from commit d663d34685e18588748569468c672763f4c73b3e)
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 98a60f7..0467c8f 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -2,6 +2,7 @@
import os.path
import sys
import textwrap
+from test import support
def format_duration(seconds):
@@ -61,4 +62,4 @@
def print_warning(msg):
- print(f"Warning -- {msg}", file=sys.stderr, flush=True)
+ support.print_warning(msg)