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

Don't strip filename from errors #90

Closed
markusschmaus opened this issue Jun 10, 2020 · 2 comments · Fixed by #93
Closed

Don't strip filename from errors #90

markusschmaus opened this issue Jun 10, 2020 · 2 comments · Fixed by #93
Assignees

Comments

@markusschmaus
Copy link

These lines strip the file name from the reported errors.
https://github.com/dbader/pytest-mypy/blob/8c99601158157ad96698d5a89357035e701bcf90/src/pytest_mypy.py#L234-L237

While this results in a cleaner looking output, it means the output is less useful when using pytest-mypy with other tools like Pycharm. When I change the code to include the filename, Pycharm turns it into a link which I can click to bring me directly to the place where the error is. Without the filename this doesn't work.

@jduprey
Copy link

jduprey commented Jul 30, 2020

I would be great if PyCharm could parse the output like it does other tests run by pytest.

@jaraco
Copy link

jaraco commented Aug 29, 2024

In pypa/setuptools#4502, we've dived deep into this issue and find the default behavior of pytest-mypy to be suboptimal. It's inconsistent with the output from other tools, including mypy itself, which include the relative file path on each line. As pointed out, without this path, editors like VSCode and Pycharm are unable to provide easy hyperlinks to the relevant causes. The hook to customize the output is nice, but it requires each and every downstream project to implement something, or for someone to write yet another plugin to customize the behavior. Ideally, pytest-mypy would provide a default that's consistent with other tools and friendly to developers out of the box.

Would this project consider one or more of these options:

  • make relative path emission the default behavior and allow users to opt-out
  • provide an option to customize the emission strategy (e.g. --mypy-path-reporting={none,relative,absolute})

Feel free to transfer this comment to a new issue if you agree.

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.

4 participants