Hey! I’ve encountered a problem when generating a...
# general
m
Hey! I’ve encountered a problem when generating a raw coverage file. I’m not sure if I’ve configured Pants correctly. Any chance you can take a look at https://github.com/pantsbuild/pants/issues/20333? Thanks 🙏
b
have you tried specifying the report results in a list format like the docs have, ie:
Copy code
[coverage-py]
report = ["raw", "html"]
[edit: not the root issue] also it seems like you’re missing
relative_files = true
in your
[run]
section in
.coveragerc
. if you look in the docs, it calls out this being required in order for Pants to work. mine looks like this:
Copy code
[run]
relative_files = true
branch = true

[report]
show_missing = true
exclude_also =
    def __repr__
    if self.debug:
    if settings.DEBUG
    raise AssertionError
    raise NotImplementedError
    if 0:
    if __name__ == .__main__.:
    if TYPE_CHECKING:
    class .*\bProtocol\):
    @(abc\.)?abstractmethod
for reference: https://www.pantsbuild.org/v2.17/docs/python-test-goal
You 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.
yeah it looks like that was it
Screenshot 2023-12-24 at 3.56.19 PM.png
Screenshot 2023-12-24 at 3.59.33 PM.png
then if i copy the
htmlcov
directory and inspect
index.html
i get
Screenshot 2023-12-24 at 3.55.08 PM.png
m
That’s amazing! I totally missed that! Big thanks John
Do you think we should alter the docs to show this information as a more displayable note?
b
I suppose it couldn’t hurt 🙂
m