Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unregistered plugin still receives hook calls #732

Closed
pytestbot opened this issue Apr 25, 2015 · 1 comment
Closed

Unregistered plugin still receives hook calls #732

pytestbot opened this issue Apr 25, 2015 · 1 comment
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Gleb Dubovik (BitBucket: dubglan, GitHub: dubglan)


When an instance of a class-based plugin is unregistered, it continues to receive hook calls from all items in the same file.

This happens because some hooks are sent through Node.ihook which is an instance of FSHookProxy. When FSHookProxy is created (on the first call of the given hook), it copies original HookCaller from PluginManager through HookRelay. _getcaller() -> HookCaller.new_cached_caller(). This creates a copy of all methods in HookCaller and even though the instance of the caller in PluginManager is refreshed on plugin removal, the copy in FSHookProxy is not refreshed and retains references to removed plugin methods.

Moreover, if new plugin is registered during test file execution (say, on the second test), it will not receive any hook calls. However, if new plugin exposes a hook that was never called before, that call will get through.

Is it an intended behavior that the set of hooks is frozen within one fspath?


@pytestbot
Copy link
Contributor Author

Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):


fix issue732: make sure removed plugins remove all hook callers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant