Skip to content

Conversation

@bluetech
Copy link
Member

pytest has some hooks with deprecated parameters see here. We were able to apply some hack to raise a deprecation for callers passing these parameters, but for deprecating hookimpls which requests these parameters, we need support from pluggy.

This adds support for doing this:

@hookspec(
    warn_on_impl_args={
        "lousy_arg": DeprecationWarning(
            "The lousy_arg parameter of refreshed_hook is deprecated and will be removed soon; "
            "use awesome_arg instead"
        ),
    },
)
def refreshed_hook(lousy_arg, awesome_arg):
    pass

I have verified that this works for pytest.

Fix #178.

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.

LGTM, thanks!

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

this looks good - im hoping we can expand it to ensure forward/backward compatibility with hook callers at some point

@bluetech bluetech force-pushed the warn-on-impl-args branch from 6411fbc to 6f6ea68 Compare April 19, 2024 12:24
@bluetech bluetech merged commit b4a8c92 into pytest-dev:main Apr 19, 2024
@bluetech bluetech deleted the warn-on-impl-args branch April 19, 2024 12:33
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.

Deprecate hook parameters

3 participants