coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

No coverage reports created when running mypy with input file

Open KonstiB opened this issue 5 months ago • 6 comments

Hello, I am not that familiar with coverage.py, as I am only using it for part of an evaluation, but I ran into strange behavior and couldn't find anything related here or on stackoverflow. Hopefully I am not doing something completely wrong (or stupid).

- What happened: I am trying to produce coverage reports for the mypy module, using generated inputs. The problem is whenever I run mypy with an input file no .coverage file is created, but otherwise (meaning no file given) a report is created.

- What you did: I cloned the mypy repository (https://github.com/python/mypy) and installed it locally in a venv using the pip -e . command. I then run the command coverage run -m mypy foo.py, with foo.py beeing an empty file (or containing real code, does not seem to matter) in some folder that is not a python project(for simplicity). Though mypy returns with exactly the same output as it does, when I run mypy foo.py, no .coverage file is created.

The weird thing is, when i run the command coverage run -m mypy (without the required file parameter) it as expected, returns the error: mypy: error: Missing target module, package, files, or command., however the .coverage file is created. This is also the case when I run coverage run -m mypy --help but I guess this is just for the same reason, as also no input file is given.

- What kind of help you need: Can you explain to me, why no coverage file is created under this circumstance or how I can get coverage reports for the mypy module when inserting python files?

KonstiB avatar Sep 04 '24 17:09 KonstiB