pluggy
pluggy copied to clipboard
Handle specname hooks in subset callers
What changed
PluginManager.subset_hook_caller() now builds its exclusion set from the hook implementations registered on the target hook instead of checking whether each plugin has an attribute with the hook name.
Why
A plugin can implement a hook through @hookimpl(specname="..."), so the plugin object does not need to expose an attribute with the hook name. In that case, subset_hook_caller() previously failed to exclude the plugin and the implementation still ran.
Validation
PYTHONPATH=src python -m pytest testing\test_pluginmanager.py::test_subset_hook_caller_with_specname testing\test_pluginmanager.py::test_subset_hook_caller -qPYTHONPATH=src python -m pytest testing\test_pluginmanager.py -qPYTHONPATH=src python -m pytest -quv run pytest -quv run pre-commit run -a