Skip to content

Commit

Permalink
Tweak docs a little
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Mar 7, 2024
1 parent c6962b8 commit 38c5f24
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,25 @@ You can also set the session timeout the pytest configuration file using the ``s
Cooperative timeouts
-----------------

Session timeouts are cooperative timeouts. The plugin checks the session time at the end of
each test function, and stops further tests from running if the session timeout is exceeded.
Session timeouts are cooperative timeouts. pytest-timeout checks the
session time at the end of each test function, and stops further tests
from running if the session timeout is exceeded. The session will
results in a test failure if this occurs.

In particular this means if a test does not finish of itself, it will
only be interrupted if there is also a function timeout set. A
session timeout is not enough to ensure that a test-suite is
guaranteed to finish.

Combining session and function timeouts
---------------------------------------

It works fine to combine both session and function timeouts.
For example, to limit test functions to 5 seconds and the full session to 100 seconds::
It works fine to combine both session and function timeouts. In fact
when using a session timeout it is recommended to also provide a
function timeout.

For example, to limit test functions to 5 seconds and the full session
to 100 seconds::

pytest --timeout=5 --session-timeout=100

Expand All @@ -392,6 +403,7 @@ Unreleased
Thanks Pedro Algarvio.
- Pytest 7.0.0 is now the minimum supported version. Thanks Pedro Algarvio.
- Add ``--session-timeout`` option and ``session_timeout`` setting.
Thanks Brian Okken.

2.2.0
-----
Expand Down

0 comments on commit 38c5f24

Please sign in to comment.