summaryrefslogtreecommitdiff
path: root/src/_pytest/hookspec.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-04-07 08:08:28 +0200
committerGitHub <noreply@github.com>2020-04-07 08:08:28 +0200
commit1fd14685c5860b248c51c9a39de3595ab62f45da (patch)
tree7834e65eaaa085a59e94953ce3d7a18ace445b7e /src/_pytest/hookspec.py
parentbf3e64d473f5ee1b05f18d61de7affcfc3f55687 (diff)
downloadpytest-1fd14685c5860b248c51c9a39de3595ab62f45da.tar.gz
doc: document inversed lines with terminal report hooks (#7016)
It was surprising that `tryfirst=True` would not result in lines being added to the beginning with `pytest_report_header`. This is due to lines being reversed, and therefore the same applies to `pytest_report_collectionfinish`.
Diffstat (limited to 'src/_pytest/hookspec.py')
-rw-r--r--src/_pytest/hookspec.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py
index 962ec8b3a..210cf2255 100644
--- a/src/_pytest/hookspec.py
+++ b/src/_pytest/hookspec.py
@@ -530,6 +530,13 @@ def pytest_report_header(config, startdir):
.. note::
+ Lines returned by a plugin are displayed before those of plugins which
+ ran before it.
+ If you want to have your line(s) displayed first, use
+ :ref:`trylast=True <plugin-hookorder>`.
+
+ .. note::
+
This function should be implemented only in plugins or ``conftest.py``
files situated at the tests root directory due to how pytest
:ref:`discovers plugins during startup <pluginorder>`.
@@ -542,11 +549,18 @@ def pytest_report_collectionfinish(config, startdir, items):
return a string or list of strings to be displayed after collection has finished successfully.
- This strings will be displayed after the standard "collected X items" message.
+ These strings will be displayed after the standard "collected X items" message.
:param _pytest.config.Config config: pytest config object
:param startdir: py.path object with the starting dir
:param items: list of pytest items that are going to be executed; this list should not be modified.
+
+ .. note::
+
+ Lines returned by a plugin are displayed before those of plugins which
+ ran before it.
+ If you want to have your line(s) displayed first, use
+ :ref:`trylast=True <plugin-hookorder>`.
"""