@@ -366,14 +366,25 @@ You can also set the session timeout the pytest configuration file using the ``s
366
366
Cooperative timeouts
367
367
-----------------
368
368
369
- Session timeouts are cooperative timeouts. The plugin checks the session time at the end of
370
- each test function, and stops further tests from running if the session timeout is exceeded.
369
+ Session timeouts are cooperative timeouts. pytest-timeout checks the
370
+ session time at the end of each test function, and stops further tests
371
+ from running if the session timeout is exceeded. The session will
372
+ results in a test failure if this occurs.
373
+
374
+ In particular this means if a test does not finish of itself, it will
375
+ only be interrupted if there is also a function timeout set. A
376
+ session timeout is not enough to ensure that a test-suite is
377
+ guaranteed to finish.
371
378
372
379
Combining session and function timeouts
373
380
---------------------------------------
374
381
375
- It works fine to combine both session and function timeouts.
376
- For example, to limit test functions to 5 seconds and the full session to 100 seconds::
382
+ It works fine to combine both session and function timeouts. In fact
383
+ when using a session timeout it is recommended to also provide a
384
+ function timeout.
385
+
386
+ For example, to limit test functions to 5 seconds and the full session
387
+ to 100 seconds::
377
388
378
389
pytest --timeout=5 --session-timeout=100
379
390
@@ -392,6 +403,7 @@ Unreleased
392
403
Thanks Pedro Algarvio.
393
404
- Pytest 7.0.0 is now the minimum supported version. Thanks Pedro Algarvio.
394
405
- Add ``--session-timeout `` option and ``session_timeout `` setting.
406
+ Thanks Brian Okken.
395
407
396
408
2.2.0
397
409
-----
0 commit comments