Skip to content

Remove stale plugin distinfo entries on unregister (#763) - #782

Closed
ciperx wants to merge 1 commit into
pytest-dev:mainfrom
ciperx:fix/unregister-plugin-distinfo-763
Closed

ciperx wants to merge 1 commit into
pytest-dev:mainfrom
ciperx:fix/unregister-plugin-distinfo-763

Conversation

@ciperx

@ciperx ciperx commented Oct 13, 2026 •

Copy link
Copy Markdown

Summary

Fixes #763.

load_setuptools_entrypoints() appends (plugin, dist) to _plugin_distinfo, but unregister() never removed those entries. After unregistering an entry-point plugin, list_plugin_distinfo() and list_plugin_distributions() still reported it (and that list feeds pytest's plugins: header), and re-registering through entry points appended a duplicate.

unregister() now drops the plugin's entries from _plugin_distinfo (mutating in place, since the attribute is Final).

Changes

  • src/pluggy/_manager.py: unregister() removes the plugin from _plugin_distinfo.
  • testing/test_pluginmanager.py: regression test — after unregister(), both listing methods return empty, and re-registering through entry points yields exactly one entry.

Testing

python -m pytest testing/test_pluginmanager.py -q -k "setuptools or unregister_removes"
4 passed

python -m pytest testing/ -q
220 passed

Produced for an openjobs.bot listing:

@bluetech bluetech closed this Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_plugin_distinfo() keeps unregistered plugins

2 participants