-
Notifications
You must be signed in to change notification settings - Fork 123
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
Raise explicit error when impl called with pos args #60
Raise explicit error when impl called with pos args #60
Conversation
pluggy/__init__.py
Outdated
def __call__(self, *args, **kwargs): | ||
if args: | ||
raise TypeError( | ||
"hookimpl takes keyword arguments only".format(self.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that message is incorrect and cant hope to be formatted that way
i propose "hook calling supports only keyword arguments"
as sole message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha yeah.. I changed it 3 times so I'm not surprised.
Thanks for catching / I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RonnyPfannschmidt I just updated the existing test to check for the message.
Hopefully that's cool :)
there also should be an accompanying test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tgoodlet!
As @RonnyPfannschmidt mentioned, please fix the message and add a test for it.
ce2104b
to
e2fa34b
Compare
Raise an explicit TypeError to alert the user that they are calling a hookimpl incorrectly with positional args; keyword args are allowed only. Add a test too. Fixes pytest-dev#53
e2fa34b
to
7748ba0
Compare
well done, thanks |
Raise an explicit TypeError to alert the user that they are calling
a hookimpl incorrectly with positional args; keyword args are allowed
only.
Fixes #53