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

Add support for collecting global test coverage. #12078

Closed
jsirois opened this issue May 14, 2021 · 2 comments · Fixed by #12080
Closed

Add support for collecting global test coverage. #12078

jsirois opened this issue May 14, 2021 · 2 comments · Fixed by #12080
Assignees

Comments

@jsirois
Copy link
Member

jsirois commented May 14, 2021

Right now Pants doesn't report on untested files as warned about under 'Coverage will not report on unencountered files' here: https://www.pantsbuild.org/docs/python-test-goal#coverage

This can be problematic if you want a global view of test coverage.

@jsirois
Copy link
Member Author

jsirois commented May 14, 2021

I experimented this morning and its very quick to generate a dummy coverage data file for all sources with coverage run --source=src/root empty.py. Combining that with the coverage data files from test runs produces a report that misses no source files at all.

@Eric-Arellano
Copy link
Contributor

Very cool! I spent a lot of time trying to get this working and could not for the life of me get it figured out.

This is great news!

@jsirois jsirois self-assigned this May 14, 2021
jsirois added a commit to jsirois/pants that referenced this issue May 14, 2021
Add `--coverage-py-global-report` that causes all Python coverage
reports generated by Pants to include coverage for all Python files in
all registered source roots.

Closes pantsbuild#12078

[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
jsirois added a commit that referenced this issue May 14, 2021
Add `--coverage-py-global-report` that causes all Python coverage
reports generated by Pants to include coverage for all Python files in
all registered source roots.

Closes #12078
jsirois added a commit to jsirois/pants that referenced this issue May 19, 2021
Add `--coverage-py-global-report` that causes all Python coverage
reports generated by Pants to include coverage for all Python files in
all registered source roots.

Closes pantsbuild#12078

(cherry picked from commit 487c466)

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Eric-Arellano pushed a commit that referenced this issue May 19, 2021
)

Add `--coverage-py-global-report` that causes all Python coverage
reports generated by Pants to include coverage for all Python files in
all registered source roots.

Closes #12078

(cherry picked from commit 487c466)

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants