Merge pull request #5441 from nicoddemus/faulthandler-5440
Integrate pytest-faulthandler into the core
This commit is contained in:
@@ -1084,6 +1084,23 @@ passed multiple times. The expected format is ``name=value``. For example::
|
||||
for more details.
|
||||
|
||||
|
||||
.. confval:: faulthandler_timeout
|
||||
|
||||
Dumps the tracebacks of all threads if a test takes longer than ``X`` seconds to run (including
|
||||
fixture setup and teardown). Implemented using the `faulthandler.dump_traceback_later`_ function,
|
||||
so all caveats there apply.
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
# content of pytest.ini
|
||||
[pytest]
|
||||
faulthandler_timeout=5
|
||||
|
||||
For more information please refer to :ref:`faulthandler`.
|
||||
|
||||
.. _`faulthandler.dump_traceback_later`: https://docs.python.org/3/library/faulthandler.html#faulthandler.dump_traceback_later
|
||||
|
||||
|
||||
.. confval:: filterwarnings
|
||||
|
||||
|
||||
|
||||
+32
-1
@@ -410,7 +410,6 @@ Pytest supports the use of ``breakpoint()`` with the following behaviours:
|
||||
Profiling test execution duration
|
||||
-------------------------------------
|
||||
|
||||
.. versionadded: 2.2
|
||||
|
||||
To get a list of the slowest 10 test durations:
|
||||
|
||||
@@ -420,6 +419,38 @@ To get a list of the slowest 10 test durations:
|
||||
|
||||
By default, pytest will not show test durations that are too small (<0.01s) unless ``-vv`` is passed on the command-line.
|
||||
|
||||
|
||||
.. _faulthandler:
|
||||
|
||||
Fault Handler
|
||||
-------------
|
||||
|
||||
.. versionadded:: 5.0
|
||||
|
||||
The `faulthandler <https://docs.python.org/3/library/faulthandler.html>`__ standard module
|
||||
can be used to dump Python tracebacks on a segfault or after a timeout.
|
||||
|
||||
The module is automatically enabled for pytest runs, unless the ``-p no:faulthandler`` is given
|
||||
on the command-line.
|
||||
|
||||
Also the :confval:`faulthandler_timeout=X<faulthandler_timeout>` configuration option can be used
|
||||
to dump the traceback of all threads if a test takes longer than ``X``
|
||||
seconds to finish (not available on Windows).
|
||||
|
||||
.. note::
|
||||
|
||||
This functionality has been integrated from the external
|
||||
`pytest-faulthandler <https://github.com/pytest-dev/pytest-faulthandler>`__ plugin, with two
|
||||
small differences:
|
||||
|
||||
* To disable it, use ``-p no:faulthandler`` instead of ``--no-faulthandler``: the former
|
||||
can be used with any plugin, so it saves one option.
|
||||
|
||||
* The ``--faulthandler-timeout`` command-line option has become the
|
||||
:confval:`faulthandler_timeout` configuration option. It can still be configured from
|
||||
the command-line using ``-o faulthandler_timeout=X``.
|
||||
|
||||
|
||||
Creating JUnitXML format files
|
||||
----------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user