From f4f23e8e097d383758d128a2d70816660779353a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 30 Sep 2015 16:12:33 +0300 Subject: [PATCH 1/2] Correct hook examples in docs. --- doc/en/writing_plugins.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 1e9807cf5..865b079be 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -332,17 +332,17 @@ after others, i.e. the position in the ``N``-sized list of functions: .. code-block:: python # Plugin 1 - @pytest.hookimpl_spec(tryfirst=True) + @pytest.mark.tryfirst def pytest_collection_modifyitems(items): # will execute as early as possible # Plugin 2 - @pytest.hookimpl_spec(trylast=True) + @pytest.mark.trylast def pytest_collection_modifyitems(items): # will execute as late as possible # Plugin 3 - @pytest.hookimpl_spec(hookwrapper=True) + @pytest.hookimpl(hookwrapper=True) def pytest_collection_modifyitems(items): # will execute even before the tryfirst one above! outcome = yield From c8f5a40fd98b28c5f1f3296a7e853ffe40644a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Wed, 30 Sep 2015 16:58:12 +0300 Subject: [PATCH 2/2] Edit examples again to use hookimpl. --- doc/en/writing_plugins.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 865b079be..bc738f513 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -332,12 +332,12 @@ after others, i.e. the position in the ``N``-sized list of functions: .. code-block:: python # Plugin 1 - @pytest.mark.tryfirst + @pytest.hookimpl(tryfirst=True) def pytest_collection_modifyitems(items): # will execute as early as possible # Plugin 2 - @pytest.mark.trylast + @pytest.hookimpl(trylast=True) def pytest_collection_modifyitems(items): # will execute as late as possible