New issue 732: Unregistered plugin still receives hook calls
https://bitbucket.org/pytest-dev/pytest/issue/732/unregistered-plugin-still-receives-hook

Gleb Dubovik:

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?


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to