Closed rayzchen closed 2 years ago
The coverage xml
command already has an --ignore-errors
option, isn't that what you need? If not, then I'm not understanding the problem.
Is there a way to disable coverage scanning for anything that is run with exec
during coverage run
? --ignore-errors
does fix it but it isn't exactly how I imagined to fix it.
Coverage.py doesn't have a way to do that, no.
Describe the bug A clear and concise description of the bug.
coverage xml
cannot find files that were generated and compiled withcompile
. In ideal situations we would want coverage recorded for these files but in our case we simply don't really need it, as it's only testing a certain functionality that only defines a class. A flag that ignoresexec
orcompile
would be very helpful.To Reproduce How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
coverage debug sys
is helpful.pip freeze
is helpful.coverage run -m unittest tests.py
coverage xml
Expected behavior Report generation success Additional context I usecompile(text, "file1.py", "exec")
which results in