diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-05-08 20:20:54 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-05-08 20:20:54 (GMT) |
commit | 98b9c07ab76c7fa0b77c3cb683ab92c49ef3bbdc (patch) | |
tree | bd471cb04ba80a136e43540d804423ac17568fec /Doc | |
parent | 5d023c3afacf4af2bcaedcb63305a36e179f0236 (diff) | |
download | cpython-98b9c07ab76c7fa0b77c3cb683ab92c49ef3bbdc.zip cpython-98b9c07ab76c7fa0b77c3cb683ab92c49ef3bbdc.tar.gz cpython-98b9c07ab76c7fa0b77c3cb683ab92c49ef3bbdc.tar.bz2 |
Document the 'record' argument for test.test_support.catch_warning().
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/test.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 69ead89..818ff8e 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -283,13 +283,15 @@ The :mod:`test.test_support` module defines the following functions: This will run all tests defined in the named module. -.. function:: catch_warning() +.. function:: catch_warning(record=True) - This is a context manager that guards the warnings filter from being + Return a context manager that guards the warnings filter from being permanently changed and records the data of the last warning that has been - issued. + issued. The ``record`` argument specifies whether any raised warnings are + captured by the object returned by :func:`warnings.catch_warning` or allowed + to propagate as normal. - Use like this:: + The context manager is typically used like this:: with catch_warning() as w: warnings.warn("foo") |