Trying to get html-reporter pytest plugin working ...
# general
h
Trying to get html-reporter pytest plugin working (https://pypi.org/project/pytest-html-reporter/). No luck so far. I have the following in my pants.toml:
[GLOBAL]
pants_version = "2.3.0.dev3"
[pytest]
pytest_plugins.add = [
"pytest-html-reporter==0.2.3"
]
args = [
"--html-report=./dist/report.html"
]
h
What's the error? That is generally how you add plugins
h
Just no report.html in the dist folder. No errors being reported. If I run pytest directly I get the report.html.
h
Oh, ik what it is. When you run a process with the plugin API, the rule author has to say which output files to capture. The plugin is working, but Pants isn't capturing the result So I think this might need first class support to work. Would you be interested in adding that?
h
I could try
I don't suppose there is a built in way to generate html for tests? I see that you can generate XML but not HTML.
h
K I'll write some instructions in a couple minutes, I don't think this will involve many changes Not yet, but there will be once your change lands :)
h
👍
h
Hm nevermind on this being trivial. It's a bit more complex because we need to write the reports to the workspace, which means changing the generic
test.py
code, not only the Pytest specific code Bigger complication, it looks like this plugin creates a single report for your entire run, right? That won't work well with how Pants splits up your test runs into multiple processes. You would end up with one report per test file. Unless this plugin has something like a `combine`/`merge` command, you would not have one nice unified report. Would that still be useful for you?
h
Not sure a bunch of individual reports is what I would want. If it had been easy to do it would be nice but not essential.
👍 1
h
There is a utility to convert junit.xml style output into HTML
👍 1
and it is possible to merge the XML
so this is feasible, and could even be done generically (for any test runner that outputs junit.xml)