No More “How to Create Pytest HTML Reports or how to email test reports”


Today I ran into something funny — I needed a decent HTML report for my pytest run, and my first thought was:
another half-hour lost to figuring out pytest-html configs.

Usually, that means:

  • Installing pytest-html or allure-pytest
  • Setting up .ini or passing a long list of CLI flags (or even installing Java in allure’s case)
  • Making sure people on other machines can actually open the report
  • Writing a little conftest.py hook to add metadata
  • Trying not to break CI/CD in the process

Time spent? Way too much, just for a simple report.

And in my case, there was another catch — I was running tests in parallel with pytest-xdist.

If you’ve done that before, you will need another merger plugin to merge all the xmls

So I looked around for that plugin but found pytest-html-plus.

I didn’t even read the docs at first — I just installed it:

pip install pytest-html-plus
pytest -n auto

Done.

That’s it.
…and it just worked.
Full HTML report, already pretty, self-contained, no setup, no config.

What surprised me:

  • It handled parallel runs without breaking the report (even with xdist)
  • Added metadata like branch, commit, environment, and timestamp automatically

I could copy logs and errors with one click

The report was shareable as-is without worrying about dependencies

I didn’t have to touch a single test file — no extra hooks or decorators

Honestly, the whole “report” part of my workflow went from “ugh, I’ll do it later” to “done in 5 seconds”, even in CI.

If you’ve been wrestling with HTML reports in pytest — especially with parallel runs — this was a nice surprise.

Even better part is that I could email the test report by just triggering --plus-email

🔗 https://pypi.org/project/pytest-html-plus/



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *