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

address #8361 - introduce hook caller wrappers that enable backward compat #8463

Merged

Conversation

RonnyPfannschmidt
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt commented Mar 18, 2021

  • unittests
  • tests or receivers with legacy args + deprecation
  • remove legacy path parameters from internal calls
  • add warning for hook invocations on missing prams and suggested drops

fixes #8361

@asottile
Copy link
Member

change makes sense, probably need a test or two to demonstrate the behaviour (do we want a warning and to eventually migrate?)

@RonnyPfannschmidt RonnyPfannschmidt marked this pull request as draft March 18, 2021 22:28
@RonnyPfannschmidt RonnyPfannschmidt changed the title address #8361 - introduce hook caller wrappers that enable backward compat WIP: address #8361 - introduce hook caller wrappers that enable backward compat Mar 18, 2021
@nicoddemus
Copy link
Member

I also think this is a good approach to #8361. 👍

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this.

As I mentioned, I don't think we really need to do this, but if we can have a way to deprecate, I guess it's OK.

I think wrapping at the config.hook level is not sufficient -- some of the hooks use an FSHookProxy (gethookproxy) which uses the plugin manager directly. I think if possible it would be better to add this directly on the PytestPluginManager.

I'm also think this might have some non-negligible effect on performance but I didn't measure. Can do once it's further along.

proxy = FSHookProxy(pm, remove_mods)
from .config.compat import PathAwareHookProxy

proxy = PathAwareHookProxy(FSHookProxy(pm, remove_mods))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bluetech here i wrap that one

@RonnyPfannschmidt
Copy link
Member Author

@bluetech i believe, in a followup i can even add some bits to ensure the cost can be removed if people opt out of legacy paths

@RonnyPfannschmidt RonnyPfannschmidt marked this pull request as ready for review March 27, 2021 14:57
@RonnyPfannschmidt RonnyPfannschmidt changed the title WIP: address #8361 - introduce hook caller wrappers that enable backward compat address #8361 - introduce hook caller wrappers that enable backward compat Mar 27, 2021
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great work, please see my comments!

src/_pytest/config/compat.py Show resolved Hide resolved
src/_pytest/config/compat.py Show resolved Hide resolved
src/_pytest/config/compat.py Outdated Show resolved Hide resolved
src/_pytest/config/compat.py Show resolved Hide resolved
src/_pytest/config/compat.py Show resolved Hide resolved
src/_pytest/deprecated.py Outdated Show resolved Hide resolved
src/_pytest/config/compat.py Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
doc/en/deprecations.rst Outdated Show resolved Hide resolved
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! thanks for the good tests

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@RonnyPfannschmidt RonnyPfannschmidt merged commit 41a90cd into pytest-dev:main Apr 5, 2021
@RonnyPfannschmidt RonnyPfannschmidt deleted the workaround-8361 branch April 5, 2021 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resolve startpath/fspath parameter regressions
4 participants