Skip to content
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

Don't show the omitted files in the Test Coverage Toolbar #24366

Open
paduszyk opened this issue Oct 8, 2024 · 7 comments
Open

Don't show the omitted files in the Test Coverage Toolbar #24366

paduszyk opened this issue Oct 8, 2024 · 7 comments
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on

Comments

@paduszyk
Copy link

paduszyk commented Oct 8, 2024

I like the new Test Coverage Toolbar feature. I use it with Python and Coverage.py run via pytest and pytest-cov plugin.

Coverage.py enables omitting some files using globs (e.g. configuration modules or development scripts; see docs). I think that NOT showing those files in the toolbar could be an interesting enhancement.

Sorry if you find this issue biased to Python. I am not so familiar with other languages and testing tools available for them.

@eleanorjboyd
Copy link
Member

good idea yes! I can do this specifically on the python side. This will need development time so just putting it for community feedback to see how many people are hitting this issue

@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode Oct 30, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 30, 2024
@eleanorjboyd eleanorjboyd added needs community feedback Awaiting community feedback community ask Feature request that the community expressed interest in labels Oct 30, 2024
Copy link

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@eleanorjboyd
Copy link
Member

"Run Test with Coverage" should allow omitting files from the report. Ideally, honor the "omit" setting in the coverage configuration. Some default arguments may be set, such as .venv.

It seems this can be done using a workaround, namely, by using tool.coverage.run.omit (as opposed to tool.coverage.report.omit, which I tried previously).

[tool.coverage.run]
omit = [
    ".venv/*",
    # https://github.com/nedbat/coveragepy/issues/1392
    "pyscript",
    "shibokensupport/*",
    "signature_bootstrap.py",
]

copied from #24309 as both are related to omitting files for coverage

@eleanorjboyd
Copy link
Member

Hi @paduszyk! In what way did you configure your file to omit? I did the most basic setup and it worked for me:

Image

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 13, 2024
@paduszyk
Copy link
Author

@eleanorjboyd Actually, I configure the omit option in [report] section, not [run]. In fact, Coverage.py accepts both cases:

https://coverage.readthedocs.io/en/7.6.5/config.html#run-omit
https://coverage.readthedocs.io/en/7.6.5/config.html#report-omit

But, to be honest, the difference is not clear to me. I use the latter, as it sounds more logical to me to use report section to affect the behavior referred to coverage reports.

Besides, I prefer pyproject.toml as the configuration "hub". I don't think however this can be an issue here.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Nov 15, 2024
@paduszyk
Copy link
Author

@eleanorjboyd Indeed, if I move omit to [run] section, the omitted files are not shown by GUI (the desired behavior). So it looks like the problem is probably with Coverage.py.

@eleanorjboyd
Copy link
Member

hm yes this is a good point about the [report] vs [run], I am not entirely sure which should control the behavior of the coverage view in vscode. The reason I lean towards [run] is we are not actually producing a [report] but after further investigate i see that the output from coverage (just when run in the terminal like with python -m pytest --cov=. does omit files listed under [report]. Since the extension goal is to always best mirror real behavior- I think omit for report should be respected. Let me investigate how difficult this would be and I will let you know. If it requires a coverage.py API change I will likely talk with Ned at coverage and get his thoughts specifically.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 18, 2024
@eleanorjboyd eleanorjboyd added needs PR Ready to be worked on bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team needs community feedback Awaiting community feedback community ask Feature request that the community expressed interest in labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

4 participants
@connor4312 @eleanorjboyd @paduszyk and others