Issue #18948: improve SuppressCoreFiles to include Windows crash popup suppression, and use it in more tests.

Patch by Valerie Lambert and Zachary Ware.
This commit is contained in:
Antoine Pitrou 2013-10-08 23:04:32 +02:00
parent 3ebbb04af2
commit 77e904e6a6
8 changed files with 87 additions and 94 deletions

View file

@ -442,13 +442,6 @@ The :mod:`test.support` module defines the following functions:
A decorator for running tests that require support for symbolic links.
.. function:: suppress_crash_popup()
A context manager that disables Windows Error Reporting dialogs using
`SetErrorMode <http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx>`_.
On other platforms it's a no-op.
.. decorator:: anticipate_failure(condition)
A decorator to conditionally mark tests with
@ -593,6 +586,21 @@ The :mod:`test.support` module defines the following classes:
Temporarily unset the environment variable ``envvar``.
.. class:: SuppressCrashReport()
A context manager used to try to prevent crash dialog popups on tests that
are expected to crash a subprocess.
On Windows, it disables Windows Error Reporting dialogs using
`SetErrorMode <http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx>`_.
On UNIX, :func:`resource.setrlimit` is used to set
:attr:`resource.RLIMIT_CORE`'s soft limit to 0 to prevent coredump file
creation.
On both platforms, the old value is restored by :meth:`__exit__`.
.. class:: WarningsRecorder()
Class used to record warnings for unit tests. See documentation of