Skip to content

Commit bf9977f

Browse files
committed
Schedule deprecated legacy hook marks for removal in pytest 10
By the time pytest 10 is released, this will have been deprecated for more than 5 years (0fdacb6), and the alternative syntax available for over 10 years (d2a5c7f), which seems like enough time. Removal will simplify PytestPluginManager and leave us with one way for setting hookspec/hookimpl options (the plan after removal is to just treat the old markers as normal markers, not hard-error on them).
1 parent bc57e69 commit bf9977f

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

changelog/14335.deprecation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The method of configuring hooks using markers, deprecated since pytest 7.2, is now scheduled to be removed in pytest 10.
2+
See :ref:`hook-markers` for more details.

doc/en/deprecations.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,13 @@ Simply remove the ``__init__.py`` file entirely.
171171
Python 3.3+ natively supports namespace packages without ``__init__.py``.
172172

173173

174+
.. _hook-markers:
175+
174176
Configuring hook specs/impls using markers
175177
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176178

179+
.. deprecated:: 7.2
180+
177181
Before pluggy, pytest's plugin library, was its own package and had a clear API,
178182
pytest just used ``pytest.mark`` to configure hooks.
179183

src/_pytest/deprecated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040

4141
HOOK_LEGACY_MARKING = UnformattedWarning(
42-
PytestDeprecationWarning,
42+
PytestRemovedIn10Warning,
4343
"The hook{type} {fullname} uses old-style configuration options (marks or attributes).\n"
4444
"Please use the pytest.hook{type}({hook_opts}) decorator instead\n"
4545
" to configure the hooks.\n"

0 commit comments

Comments
 (0)