-
Notifications
You must be signed in to change notification settings - Fork 33
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
Improve pytest failure output for mypy #99
Comments
This should work in a def custom_file_reportinfo(file_item):
return (
file_item.fspath,
None,
'[mypy] ' + file_item.config.invocation_dir.bestrelpath(
file_item.fspath,
),
)
def pytest_configure(config):
plugin = config.pluginmanager.getplugin("mypy")
plugin.MypyFileItem.reportinfo = custom_file_reportinfo Let's leave this open until a test for that is added (to ensure continued support) or a better API is proposed. |
This indeed does work well, thank you! Could we consider to make this the default option? I've found it to be quite useful to see which plugin a given failure belongs to. Other plugins I use seem to do this by default (somewhat):
Of course, as an alternative I'll just patch each of them with an improved version of your custom reportinfo function, hehe:
Dynamic languages are such fun! |
It seems that the failures for pylint have
[pylint]
prepended to the filename in the failure output:It would be great to have
[mypy]
prepended to the filenames of the errors that belong to mypy (the second list of errors on the picture above). Or is this something that can be somehow configured in mypy and/or somewhere in pytest?The text was updated successfully, but these errors were encountered: