Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/166.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``stacklevel=2`` to implprefix warning so that the reported location of warning is the caller of PluginManager.
1 change: 1 addition & 0 deletions pluggy/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, project_name, implprefix=None):
"Support for the `implprefix` arg is now deprecated and will "
"be removed in an upcoming release. Please use HookimplMarker.",
DeprecationWarning,
stacklevel=2,
)
self._implprefix = implprefix
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
Expand Down
6 changes: 6 additions & 0 deletions testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ def he_method1(self):
undo()


def test_implprefix_warning(recwarn):
PluginManager(hookspec.project_name, "hello_")
w = recwarn.pop(DeprecationWarning)
assert "test_pluginmanager.py" in w.filename


@pytest.mark.parametrize("include_hookspec", [True, False])
def test_prefix_hookimpl(include_hookspec):
with pytest.deprecated_call():
Expand Down