Repository navigation
Remove stale plugin distribution entries on unregister - #789
Closed
antiren1980-ship-it wants to merge 1 commit into
Closed
antiren1980-ship-it wants to merge 1 commit into
antiren1980-ship-it wants to merge 1 commit into
Conversation
'load_setuptools_entrypoints()' appends to '_plugin_distinfo', but 'unregister()' only removed the plugin from '_name2plugin' and the hook callers. As a result 'list_plugin_distinfo()' and 'list_plugin_distributions()' kept reporting an unregistered plugin, and re-registering it added a duplicate entry. 'unregister()' now also drops the plugin's '_plugin_distinfo' entries. Fixes pytest-dev#763
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
load_setuptools_entrypoints()appends to_plugin_distinfo, butunregister()only removed the plugin from_name2pluginand its hook callers. As a result:list_plugin_distinfo()andlist_plugin_distributions()kept reporting an unregistered plugin;unregister()now also drops the plugin's_plugin_distinfoentries, so both views stay in sync and re-registration does not create duplicates.Fix
src/pluggy/_manager.py— after removing the plugin from_name2plugin, filter it out of_plugin_distinfo:Tests
Added
test_unregister_removes_plugin_distinfowhich:load_setuptools_entrypoints(),list_plugin_distinfo()andlist_plugin_distributions()are empty,The test fails on
mainand passes with the fix.Fixes #763