Hi there, I got a question about coverage html rep...
# general
c
Hi there, I got a question about coverage html report. We are currently on pants v.1.28 in pure v2 mode. After executing pytest, the junit xml results is generated successfully. How do I generate html coverage report on top of that? Pants was able to generate both xml and html report previously on v1 mode.
❀️ 1
p
You will need to add the following options:
Copy code
--use-coverage --pytest-coverage-report=xml
See
./pants --v2 --no-v1 help test.pytest
for details about them.
Currently you can only choose one type of report, but I have an open issue to add support for multiple ones in the same run. https://github.com/pantsbuild/pants/issues/9968
c
thanks @polite-garden-50641 ! I'll give that a try
p
Please note that this is still somewhat experimental.. (hence it is not in the docs yet), it should declared stable in the next few weeks.
πŸ‘Œ 1
@hundreds-father-404 I think this is worth documenting, we can put some kind of notice on the docs about this.
πŸ‘ 2
c
I added the flag
--test-pytest-coverage-reports=html
but pants is not generating the html report.. would I be able to choose between xml or html report in v.1.28?
h
That’s the wrong option. Run
help-advanced pytest
. Sorry for the confusion
c
hey @hundreds-father-404 The options listed are only for XML result files.. there's no option for generating html report πŸ˜•
h
Aww @clever-table-90691 sorry I was afk and gave you the wrong advice! My apologies. Please set the option
report = "html"
in the
[pytest-coverage]
option scope. Aka,
--pytest-coverage-report=html
.
Sorry about the confusion - we will document this very soon
c
no worries, let me give that a try πŸ™‚ thanks
Both worked!! Using either [pytest-coverage] with report option OR the flag --pytest-coverage-report=html worked! And it executed way faster than v1! I'm also able to generate both xml and html report by keeping the junit_xml_dir option in [pytest] Thanks a lot for both of your help πŸ™‚
πŸ‘ 1
❀️ 2
h
Yay! Glad to hear! And yes, the flag and pants.toml values are the same