Skip to content

Unclear Coverage Results #18926

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

Open
Lyranile opened this issue Apr 15, 2025 · 2 comments
Open

Unclear Coverage Results #18926

Lyranile opened this issue Apr 15, 2025 · 2 comments
Labels
bug mypy got something wrong pending Issues that may be closed

Comments

@Lyranile
Copy link

Describe the bug
Coverage report with mypy is not clear and not descriptive

To Reproduce
When using mypy report or coverage on pytest the result I'm seeing is not clear

Missing 1-6 4-7 8-7 main.py

This result only shows me the lines with the problem but not what is the problem

The closest I've gotten to seeing the full issue is when using the --report in mypy or other libraries and using html

Mypy src --html-report test

When inspecting the elements I can see issues like any type not recognized or unannotated type set, but the line is usually not correct as it might be related to the definition of the var

var: Var = some_untyped_function()

var.element <---- line that failes

What can I do to make the error clearer, see exactly what failed and how to fix it if possible

Also for reference I opened the same issue in the pycoverage repository and they're saying it might be a mypy thing

nedbat/coveragepy#1948

@Lyranile Lyranile added the bug mypy got something wrong label Apr 15, 2025
@brianschubert
Copy link
Collaborator

brianschubert commented Apr 15, 2025

I'm sorry, I don't understand what you mean. Can you please show the output you are seeing and provide a minimal snippet of code that reproduces the problem?

@brianschubert brianschubert added the pending Issues that may be closed label Apr 15, 2025
@Lyranile
Copy link
Author

If that's okay in keeping both similar issues open just because I see them as 2 separate issues, so I'll just mention what I said in the other one

image.png

Heres the result of the mypy coverage for all of my changes, this shows only the percentage of how much is covered

mypy --cobertura-xml-report .
diff-cover mypy --compare-branch origin/master

I need to see exactly why this isn't 100%, and this is regarding the report

The problem is mainly that I only see issues with the --report flag
mypy .
Wouldn't show any issues while --report show missing lines

The best I could've gotten to show the exact issues of these lines is with --html-report, because inspecting the element show the exact problem

TLDR
image-1.png
I found this console.print being a problem of "explicit any type"

And I'm guessing it's because of this
image-2.png
Having the Console type mentioned, but I need you to help me validate that

What do I expect?
Mypy should show me the exact issues such as when console is having an explicit type

The CLI should have a way to get a detailed view these issues and what mypy thinks is the problem (here I've just stumbled upon inspection that developer tools show me the issue clearer)

Or, the command mypy src to show problems that mypy src --html-report or --xml-report or any report shows
image-3.png
image-1.png

Let me know if I'm not understanding it correctly or if there's something like this

Originally posted by @Lyranile in #18927 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong pending Issues that may be closed
Projects
None yet
Development

No branches or pull requests

2 participants