You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
list_plugin_distributions() raises KeyError for entry points that register() declined (regression from #767)聽#807
馃 Written by Claude Opus 5.5 via Claude Code for the pluggy maintainers; I prompted it, it did the work, I read it.
Since #767 (merged, unreleased), load_setuptools_entrypoints() records every loaded entry point in _name2dist keyed by ep.name, whether or not register() actually registered it:
list_plugin_distributions() then looks each name up with self._name2plugin[name], and list_plugin_distinfo() calls it. When register() declines a plugin (it returns None for a None plugin, and pytest's PytestPluginManager.register() returns None for the plugins merged into pytest such as pytest_faulthandler and pytest_catchlog), the name is recorded but never registered. The lookup then fails with KeyError.
Impact: with pytest-faulthandler installed, a pytest run built on pluggy main crashes with INTERNALERROR ... KeyError: 'pytest_faulthandler' while printing the header, because the header lists plugins through list_plugin_distinfo(). 1.7.0 is not affected because it stored (plugin, dist) pairs.
Fix: use the return value of register(). Skip the bookkeeping and the count when it is None, and otherwise key _name2dist by the returned name. The test should cover a None plugin and a PluginManager subclass whose register() returns None.
Activity