Repository navigation
Conversation
PluginManager.unregister removed the plugin from its hook callers and from _name2plugin, but left its _plugin_distinfo entry behind. A plugin loaded through entry points therefore kept being reported by list_plugin_distinfo() and list_plugin_distributions() after unregister(), and re-registering it appended a second entry for the same plugin. unregister now removes every distinfo entry belonging to the plugin, so both listings reflect the live registry. Adds regression coverage for the name form, the plugin-object form, and the unregister-then-reload path.
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.
Fixes #763.
PluginManager.unregister()removed the plugin from its hook callers and from_name2plugin, but left its_plugin_distinfoentry in place. For a plugin loaded through entry points that means:list_plugin_distinfo()andlist_plugin_distributions()kept reporting the plugin after it had been unregistered, so the listings disagreed withget_plugin()/has_plugin().Change
unregister()now also removes the distinfo entries belonging to that plugin:Rebinding in place (rather than assigning a new list) keeps the existing list object, since the attribute is annotated
Final. No public API change, no new dependency.Regression coverage
testing/test_unregister_distinfo.pycovers three paths:list_plugin_distinfo()andlist_plugin_distributions();registerdoes not leave a stale entry, and a later entry-point reload produces exactly one entry again;Verification
With the
_plugin_distinfocleanup reverted, all three new tests fail (3 failed), so the coverage is not vacuous.This work was completed for OpenJobs listing
eb2edb80-4a8f-4a90-9d26-859c4b977f65(https://openjobs.bot/jobs/eb2edb80-4a8f-4a90-9d26-859c4b977f65).