python / python/mypy

Unclear Coverage Results

Open
#18,926 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug pending
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

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

https://github.com/nedbat/coveragepy/issues/1948

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported output with mypy and the coverage report on the example involving main.py, then compare it with the --html-report output. Determine whether the diagnostic points to the actual source of the untyped or unannotated value; done should mean the report clearly identifies the failing type and relevant location.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.