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

Add stdout and stderr to mypy status error #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scriptator
Copy link

Relates to #120 : adds further information to the error message so that the mentioned issue can be more easily debugged (e.g. on CI environments)

Copy link
Collaborator

@dmtucker dmtucker left a comment

Choose a reason for hiding this comment

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

Hey there 👋 Thanks for the contribution!

My only hesitance with this is that it will lead to duplicate output in most cases...

============================ FAILURES ============================
_______________________ demo/test_demo.py ________________________
2: error: Incompatible return value type (got "str", expected "int")
__________________________ test session __________________________
mypy exited with status 1.
stdout: demo/test_demo.py:2: error: Incompatible return value type (got "str", expected "int")
Found 1 error in 1 file (checked 1 source file)

stderr: 
============================== mypy ==============================
Found 1 error in 1 file (checked 1 source file)

I understand #120 to be an issue regarding the use of -x, and in that issue you mention needing this patch for debugging an error on your CI server. Are you using -x in that workflow?

I mainly ask because if the issue was MypyStatusError being raised on a file that wasn't collected by Pytest, that output should already be shown as unmatched_stdout:
https://github.com/dbader/pytest-mypy/blob/3c9d8d5ff8d090e63d80a7a7c6c82d37b0ae2d2a/src/pytest_mypy.py#L329-L331

============================ FAILURES ============================
__________________________ test session __________________________
mypy exited with status 1.
============================== mypy ==============================
demo/uncollected.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
Found 1 error in 1 file (checked 1 source file)

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.

2 participants