Skip to content

fix: exclude plugins registered after subset_hook_caller creation - #846

Closed
EnesKartal wants to merge 2 commits into
pytest-dev:mainfrom
EnesKartal:fix/subset-hook-caller-unregistered
Closed

EnesKartal wants to merge 2 commits into
pytest-dev:mainfrom
EnesKartal:fix/subset-hook-caller-unregistered

Conversation

@EnesKartal

Copy link
Copy Markdown

Summary

Fixes a 1.7.0 regression in PluginManager.subset_hook_caller() where plugins passed in remove_plugins that were not yet registered were discarded and not excluded when registered later.

  • Maintains an O(1) _plugin2name lookup dictionary in PluginManager (with TypeError fallback for unhashable plugins) so is_registered() is O(1)
  • Keeps any unregistered plugin in plugins_to_remove alongside plugins currently implementing the hook
  • Added regression test test_subset_hook_caller_excludes_later_registered_plugins covering both direct hookimpls and specname aliases

Verification

  • pytest -q (227 passed)

Fixes #840

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.

subset_hook_caller no longer excludes plugins registered after the proxy is created (1.7.0 regression, low priority)

2 participants