pytest-dev/pluggy

Is it possible to override an existing hook with a HookCaller class?

yakovbabich opened this issue · 0 comments

I tried to create HookCaller and to setattr but it seems like it is not working properly.

        hook_caller = HookCaller(
            name=hook_name,
            hook_execute=func(hook_name),
            spec_opts=hook.spec.opts,
            specmodule_or_class=hook.spec.namespace,
        )

        setattr(session.config.pluginmanager.hook, hook_name, hook_caller)

Also I noticed that there is rewrite_hook and I am not sure what is it for?
session.config.pluginmanager.rewrite_hook.config.hook