broad-carpet-61802
06/26/2023, 8:04 PM.coverage.1
file from the first target and a .coverage.2
file from the second:
Name Stmts Miss Cover
------------------------------------------------------------------------------------
target1 28 0 100%
Name Stmts Miss Cover
-----------------------------------------------------------------------
target2 109 24 78%
I want to combine these 2 files. As I understand it, I can't do this with the help of pants. When trying to do this with the help of pure coverage:
./pants run :coverage -- combine --rcfile=src/coverage.rc dist_pants/coverage/python
./pants run :coverage -- report --rcfile=src/coverage.rc
I get:
Name Stmts Miss Cover
------------------------------------------------------------------------------------
target1 28 28 0%
target2 109 109 0%
If I try to get only a report, I get the same result:
./pants run :coverage -- report --rcfile=src/coverage.rc --data-file=dist_pants/coverage/python/.coverage.2
Name Stmts Miss Cover
-----------------------------------------------------------------------
target2 109 109 0%
My config(coverage.rc
) looks like this:
[report]
exclude_lines =
pragma: no cover
skip_empty = True
[paths]
src =
src/
.pants.d/pyprep/sources/*/src
/root/app/.pants.d/pyprep/sources/*/src
What am I missing? Is there an analogue of the coverage combine
and coverage report
commands in pants?
Pants: v2.14, coverage: v7.2.7broad-processor-92400
06/27/2023, 12:31 AMcoverage
, but just checking that you've seen https://www.pantsbuild.org/docs/python-test-goal#coverage . Does that provide any insight?broad-carpet-61802
06/27/2023, 4:10 AMYou may use a Coverage config file, e.g. .coveragerc or pyproject.toml. Pants will autodiscover the config file for you, and you can also set [coverage-py].config in your pants.toml to point to a non-standard location. You must include relative_files = true in the [run] section for Pants to work.
so I just added relative_files = true
to my coveragerc config file. I don't quite understand what exactly this setup does, but in any case, this was the solution. So thank you, Huon!broad-processor-92400
06/27/2023, 6:02 AMbroad-carpet-61802
06/27/2023, 9:24 AMbroad-processor-92400
06/27/2023, 9:54 AM