#6647: add note to two examples

This commit is contained in:
Andrew M. Kuchling 2010-04-02 17:54:26 +00:00
parent d886290464
commit dc36d7cf85
1 changed files with 7 additions and 2 deletions

View File

@ -173,7 +173,10 @@ the warning using the :class:`catch_warnings` context manager::
While within the context manager all warnings will simply be ignored. This
allows you to use known-deprecated code without having to see the warning while
not suppressing the warning for other code that might not be aware of its use
of deprecated code.
of deprecated code. Note: this can only be guaranteed in a single-threaded
application. If two or more threads use the :class:`catch_warnings` context
manager at the same time, the behavior is undefined.
.. _warning-testing:
@ -211,7 +214,9 @@ Once the context manager exits, the warnings filter is restored to its state
when the context was entered. This prevents tests from changing the warnings
filter in unexpected ways between tests and leading to indeterminate test
results. The :func:`showwarning` function in the module is also restored to
its original value.
its original value. Note: this can only be guaranteed in a single-threaded
application. If two or more threads use the :class:`catch_warnings` context
manager at the same time, the behavior is undefined.
When testing multiple operations that raise the same kind of warning, it
is important to test them in a manner that confirms each operation is raising