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

Old-style hookimpl warning has no location information #10342

Closed
The-Compiler opened this issue Oct 6, 2022 · 3 comments · Fixed by #10343
Closed

Old-style hookimpl warning has no location information #10342

The-Compiler opened this issue Oct 6, 2022 · 3 comments · Fixed by #10343

Comments

@The-Compiler
Copy link
Member

The old-style hookimpl deprecation warning from #9118 has no way to see where the culprit is implemented. I'm now getting:

pytest.PytestDeprecationWarning: The hookimpl pytest_configure uses old-style configuration options (marks or attributes).
Please use the pytest.hookimpl(trylast=True) decorator instead

with no easy way to figure out what the problem is. I have 12 plugins installed, all of which might have a pytest_configure, and I'd rather not have to find out manually which one is the culprit. The error message should show either the plugin that's coming from, or at least the Python file it's in.

@RonnyPfannschmidt
Copy link
Member

I'll ensure to include the filename in the warning, this is another fatal flaw of the warning system

@The-Compiler
Copy link
Member Author

Ah, I agree this is somewhat of a problem with Python warnings. The location is indeed included when showing them as normal warnings, but not when turning them into exceptions (via filterwarnings = error or -Werror.

@RonnyPfannschmidt
Copy link
Member

i will make warn_explicit_for handle this better

RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Oct 6, 2022
as the warning systems own warn_explicit looses the information
we add them explicitly to the warning exceptions
RonnyPfannschmidt added a commit that referenced this issue Oct 7, 2022
…cit-add-location

fix #10342: put location into warning exceptions
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 a pull request may close this issue.

2 participants