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

Strict mode(s) - change validation rules dynamically? #48

Closed
goodboy opened this issue Feb 28, 2017 · 4 comments
Closed

Strict mode(s) - change validation rules dynamically? #48

goodboy opened this issue Feb 28, 2017 · 4 comments

Comments

@goodboy
Copy link
Contributor

goodboy commented Feb 28, 2017

As per pytest-dev/pytest#1821 @RonnyPfannschmidt has mentioned it's worth discussing if pluggy.PluginManager should have a strict mode where every single plugin which is loaded is verified against a spec instead of only performing this validation each time PluginManager.check_pending() is called.

In pytest check_pending() is only done once just prior to the pytest_cmdline_main(config=config) call meaning unverified hooks can be loaded any time afterwards.

This issue is to open discussion and brainstorming.

@nicoddemus
Copy link
Member

Note that pytest-dev/pytest#1821 is about check_pending being called too early, so plugins registered using other mechanisms or from conftest.py files can't declare hooks.

@goodboy
Copy link
Contributor Author

goodboy commented Mar 4, 2017

@nicoddemus I agree but that issue brought up the question (at least for me ) about how pluggy should support strict checking more generally. I do think that if you're looking at pluggy from a more "general purpose plugin system perspective" this kind of thing could be useful and maybe even moreso if you can configure "strictness" per hook?

I'm thinking mutiple cases in order of strictness:

  • always require a hookspec for every loaded hookimpl
  • only require a spec after some dedicated call onwards (like check_pending() but instead enables the validation permanently after some point - check_pending_forever())
  • keep the single call check that check_pending() is
  • allow for disabling validation - disable_validation()?

I also think pending is not clear and validate() or something similar is a better name.

Just some ideas.

@goodboy goodboy changed the title Strict mode - validate every implementation against its spec? Strict mode(s) - change validation rules dynamically? Mar 4, 2017
@nicoddemus
Copy link
Member

I think the current approach of explicitly calling check_pending at some point is good enough TBH. Perhaps in the future we might encounter some other use-cases where it makes sense to have additional methods of validation, but I think for now we are good.

@goodboy
Copy link
Contributor Author

goodboy commented Mar 14, 2017

@nicoddemus agreed it's obviously working well :)

I'll close this for now.

@goodboy goodboy closed this as completed Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants