Skip to content

test: cover pluggy.__version__ getattr and HookCaller._remove_plugin … - #718

Merged
RonnyPfannschmidt merged 1 commit into
pytest-dev:mainfrom
darrenhuai:test/cover-version-getattr-and-remove-plugin
Aug 12, 2026
Merged

test: cover pluggy.__version__ getattr and HookCaller._remove_plugin …#718
RonnyPfannschmidt merged 1 commit into
pytest-dev:mainfrom
darrenhuai:test/cover-version-getattr-and-remove-plugin

Conversation

@darrenhuai

Copy link
Copy Markdown
Contributor

…not-found path

Ran the suite under coverage.py and found two real gaps in otherwise near-100% covered code. The module-level getattr that lazily resolves pluggy.version via importlib.metadata (added per changelog/590.trivial.rst) had no test exercising either branch. And HookCaller._remove_plugin's ValueError, raised when asked to remove a plugin that never registered on that hook, was untested even though the normal removal path is well covered through
PluginManager.unregister.

…not-found path

Ran the suite under coverage.py and found two real gaps in otherwise
near-100% covered code. The module-level __getattr__ that lazily
resolves pluggy.__version__ via importlib.metadata (added per
changelog/590.trivial.rst) had no test exercising either branch. And
HookCaller._remove_plugin's ValueError, raised when asked to remove a
plugin that never registered on that hook, was untested even though
the normal removal path is well covered through
PluginManager.unregister.

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - the _remove_plugin handling is subject to a more detailed change at a later point

@RonnyPfannschmidt
RonnyPfannschmidt merged commit de34583 into pytest-dev:main Aug 12, 2026
19 checks passed
RonnyPfannschmidt added a commit that referenced this pull request Aug 12, 2026
ruff 0.16 enables flake8-bugbear by default, so the bare ``pluggy.nope``
expression added in #718 fails B018 and turns pre-commit.ci red on main.
Bind it to ``_`` like the other attribute-access checks in that test suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants