Skip to content

Commit d0ab361

Browse files
add test to cover nonspec hook arg missing
1 parent 5d1ffb9 commit d0ab361

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/pluggy/_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def parse_hookimpl_opts(self, plugin: _Plugin, name: str) -> HookimplOpts | None
188188
res: HookimplOpts | None = getattr(
189189
method, self.project_name + "_impl", None
190190
)
191-
except Exception: #pragma: no cover
191+
except Exception: # pragma: no cover
192192
res = {} # type: ignore[assignment] #pragma: no cover
193193
if res is not None and not isinstance(res, dict):
194194
# false positive

testing/test_pluginmanager.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,3 +757,18 @@ def configure(self) -> int:
757757
result = []
758758
pm.hook.configure.call_historic(result.append)
759759
assert result == [4, 5, 3, 2, 1, 6]
760+
761+
762+
def test_check_pending_nonspec_hook(
763+
pm: PluginManager,
764+
) -> None:
765+
hookimpl = HookimplMarker("example")
766+
767+
class Plugin:
768+
@hookimpl
769+
def a_hook(self, param):
770+
pass
771+
772+
pm.register(Plugin())
773+
with pytest.raises(HookCallError, match="hook call must provide argument 'param'"):
774+
pm.hook.a_hook()

0 commit comments

Comments
 (0)