diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-23 17:03:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-23 17:03:52 (GMT) |
commit | d663d34685e18588748569468c672763f4c73b3e (patch) | |
tree | 9d5dacf672a50135ef10efef37e3b51f20aac1ad /Doc/library/test.rst | |
parent | 02e4484f19304a0a5f484f06a3fa441c6fb6073a (diff) | |
download | cpython-d663d34685e18588748569468c672763f4c73b3e.zip cpython-d663d34685e18588748569468c672763f4c73b3e.tar.gz cpython-d663d34685e18588748569468c672763f4c73b3e.tar.bz2 |
bpo-39983: Add test.support.print_warning() (GH-19683)
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().
Diffstat (limited to 'Doc/library/test.rst')
-rw-r--r-- | Doc/library/test.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst index c33465d..0573c27 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -825,6 +825,15 @@ The :mod:`test.support` module defines the following functions: target of the "as" clause, if there is one. +.. function:: print_warning(msg) + + Print a warning into :data:`sys.__stderr__`. Format the message as: + ``f"Warning -- {msg}"``. If *msg* is made of multiple lines, add + ``"Warning -- "`` prefix to each line. + + .. versionadded:: 3.9 + + .. function:: wait_process(pid, *, exitcode, timeout=None) Wait until process *pid* completes and check that the process exit code is |