Skip to content

Need to specially handle "historic" hooks #1165

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

Closed
ionelmc opened this issue Nov 1, 2015 · 8 comments
Closed

Need to specially handle "historic" hooks #1165

ionelmc opened this issue Nov 1, 2015 · 8 comments
Labels
type: question general question, might be closed after 2 weeks of inactivity

Comments

@ionelmc
Copy link
Member

ionelmc commented Nov 1, 2015

I want to use pytest_logwarning hook in a plugin but it seems that in 2.8 it want to be called with the .call_historic() api, which is not present in 2.7.

There's an assert not self.is_historic() in pluggy's _HookCaller for some reason.

Can anyone explain what's going on and why I need to care about this "history" aspect in the the call sites?

Currently I've settled to using config.warn instead, but that isn't without annoyances - in 2.8 it don't take fslocation argument. I'm doing a 'fslocation' in config.warn.func_code.co_varnames check 😩

@nicoddemus nicoddemus added the type: question general question, might be closed after 2 weeks of inactivity label Nov 18, 2015
@nicoddemus
Copy link
Member

@ionelmc I'm afraid there's not a good solution at the moment... should we close this or perhaps move this question to pluggy's repo?

@ionelmc
Copy link
Member Author

ionelmc commented Apr 5, 2017

Hmmm... not really sure now. I think I only wanted to understand the internals a bit (iow: someone explain the "historic" things or point me in right direction).

@nicoddemus
Copy link
Member

There's now some nice docs contributed by @tgoodlet, please take a look. I suspect they might answer your questions.

@RonnyPfannschmidt
Copy link
Member

@ionelmc the introduction of historic hooks is something that happened in a unfortunate manner

adding on that there is my mistake on one of the hooks transforming it into a historic one to fix a bug

@ionelmc
Copy link
Member Author

ionelmc commented Apr 5, 2017

Now I get it. But why "call_historic" and not "deferred" or "deferred_call". So confusing :)

@ionelmc ionelmc closed this as completed Apr 5, 2017
@nicoddemus
Copy link
Member

Naming is hard 😁

@RonnyPfannschmidt
Copy link
Member

@ionelmc a historic hook records call history. its not about defer or delay, its about keeping call history and invoking newly added implementations according to the call history

@ionelmc
Copy link
Member Author

ionelmc commented Apr 6, 2017

Yes, the name makes sense from implementor's perspective (as it accurately describes the most distinctive feature in the internals). However, from user's (or client's) perspective it don't make sense as the user don't care about internals. From the user's perspective the only distinct feature is that the call will succeed even if there is no handler registered for that hook. Agree? 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question general question, might be closed after 2 weeks of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants