Skip to content

Fix plugin registration and removal to compare by identity - #770

Closed
himanshu748 wants to merge 1 commit into
pytest-dev:mainfrom
himanshu748:fix/plugin-registration-identity-760
Closed

himanshu748 wants to merge 1 commit into
pytest-dev:mainfrom
himanshu748:fix/plugin-registration-identity-760

Conversation

@himanshu748

Copy link
Copy Markdown

Fixes #760.

Use object identity for plugin registration and lookup, and for removing a plugin's hook implementations. Distinct plugins that compare equal can be registered and unregistered independently, and registry operations do not invoke their equality methods. Registering the identical object under another name still raises ValueError.

Regression coverage includes equal dataclass instances, independent hook execution and removal by object/name, duplicate-object registration, a raising __eq__, and blocked-name markers. This keeps public collection types and subset-hook behavior unchanged.

Validation:

  • Before the fix, all six new regression cases failed.
  • uv run pytest: 223 passed on CPython 3.12.14 with pytest 9.1.1.
  • uv run pre-commit run -a: passed, including mypy. Both full checks passed again with --no-sync after restoring the original lockfile.
  • Independent agent review found no blockers and independently ran all 223 tests, plus probes for explicit plugin/name validation, blocked names, and multiple implementations.

For local validation, the shallow checkout was completed with upstream version tags and the development dependencies were refreshed; the checked-in lockfile is unchanged by this PR.

AI-assisted contribution: implementation and validation were performed with OpenAI Codex, followed by independent agent review. No manual human review is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin registry compares plugins by equality, not identity

2 participants