Closed bersbersbers closed 1 week ago
There may be better solutions still. E.g., Coverage()
takes an omit
parameter that may help:
Compare also https://github.com/microsoft/vscode-python/issues/24309
How are you listing omitted files? Omitting seems to be something I need to explore in general as I have gotten a few comments related to this. How does your issue compare to https://github.com/microsoft/vscode-python/issues/24366? It seems your ask is less about the UI including or not including and more about if the run works due to files you need to skip?
At its core, this issue is not about omitting files. Being able to omit files (either during run [which is currently possible via the coverage configuration] or report [which is not currently possible], compare https://github.com/microsoft/vscode-python/issues/24309#issuecomment-2449358989) would be one workaround for this issue, but it's a different problem altogether.
In this issue, I care about error handling during the reporting phase, in case a file that existed during run
is missing during report
. This happens when a Python library unpacks code at runtime, only to delete these files when done. See https://github.com/nedbat/coveragepy/issues/1392#issuecomment-1149310741 for one example. These files will then be missing during the reporting phase, leading to errors in the VS Code extension.
This can happen for other reasons, too - e.g., when processing coverage results after uninstalling a Python library. So I would argue that the extension should catch NoSource
extensions under all circumstances.
It seems your ask is less about the UI including or not including and more about if the run works due to files you need to skip?
Yes, correct.
Thank you for the clarification! I will look into this now I understand the whole premise
The root cause of my observations in https://github.com/microsoft/vscode-python/issues/24307 (which still deserves its own solution IMHO) is https://github.com/nedbat/coveragepy/issues/1392. Unfortunately, configuring
omit
alone does not help because this code snipped does not consider it:https://github.com/microsoft/vscode-python/blob/e8dd8c057b18e7a47a389c3144e9bce948862a84/python_files/vscode_pytest/__init__.py#L432-L448
cov._check_include_omit_etc
being private, the extension cannot really know what to check. So I propose replacinghttps://github.com/microsoft/vscode-python/blob/e8dd8c057b18e7a47a389c3144e9bce948862a84/python_files/vscode_pytest/__init__.py#L440
by