pytest-xhtml
pytest-xhtml is a plugin for pytest that generates a HTML report for test results.
⚠️
pytest-xhtmlis the alternative library forpytest-html. If you have installedpytest-html, please uninstall it first.
install
# pip install
pip install pytest-xhtml
usage
- unit test
cd testing_unit
pytest test_sample.py --html=report.html
- e2e test
# install playwright library
pip install pytest-playwright
playwright install chromium
cd testing_e2e
pytest test_playwright.py --html=report.html
- http test
# install pytest-req library
pip install pytest-req
cd testing_req
pytest test_req.py --html=report.html
- HTML Report
VS pytest-html
pytest-xhtml is fully compatible with pytest-html. The only difference is a more beautiful UI style.
| Feature | pytest-html | pytest-xhtml |
|---|---|---|
| UI Style | Traditional table layout | ✨ Modern card-based dashboard (More beautiful!) |
| Generate HTML Report | pytest --html=report.html |
🟰 |
| Self-contained Report | pytest --html=report.html --self-contained-html |
🟰 |
| Custom CSS | pytest --html=report.html --css=style.css |
🟰 |
| Report Streaming | generate_report_on_test = true (pytest.ini) |
🟰 |
| Environment Redaction | environment_table_redact_list (regex) |
🟰 |
| Collapsed Rows | render_collapsed = passed,failed (pytest.ini) |
🟰 |
| Initial Sort | initial_sort = result (pytest.ini) |
🟰 |
| Hook: Report Title | pytest_html_report_title(report) |
🟰 (rename to pytest_xhtml_*) |
| Hook: Results Summary | pytest_html_results_summary(prefix, summary, postfix) |
🟰 (rename to pytest_xhtml_*) |
| Hook: Table Header | pytest_html_results_table_header(cells) |
🟰 (rename to pytest_xhtml_*) |
| Hook: Table Row | pytest_html_results_table_row(report, cells) |
🟰 (rename to pytest_xhtml_*) |
| Hook: Table HTML | pytest_html_results_table_html(report, data) |
🟰 (rename to pytest_xhtml_*) |
| Hook: Duration Format | pytest_html_duration_format(duration) |
🟰 (rename to pytest_xhtml_*) |
| Extras: HTML | extras.html('<div>...</div>') |
🟰 |
| Extras: JSON | extras.json({'name': 'pytest'}) |
🟰 |
| Extras: Text | extras.text('some text') |
🟰 |
| Extras: URL | extras.url('http://example.com/') |
🟰 |
| Extras: Image | extras.image(path_or_data, mime_type, ext) |
🟰 |
| Extras: PNG/JPG/SVG | extras.png() / extras.jpg() / extras.svg() |
🟰 |
| Extras Fixture | def test_x(extras): |
🟰 |
| ANSI Code Support | Via ansi2html (optional) |
🟰 |
Develop
# develop
git clone https://github.com/seldomQA/pytest-xhtml.git
cd pytest-xhtml
pip install .
Metadata
Release files for pytest-xhtml 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_xhtml-0.6.1.tar.gz | 5.2 MB | Without provenance | Details for pytest_xhtml-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_xhtml-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_xhtml-0.6.1-py3-none-any.whl |
Total release size: 5.3 MB
Release files / pytest_xhtml-0.6.1.tar.gz
| Download URL | pytest_xhtml-0.6.1.tar.gz |
|---|---|
| Size | 5.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87e6c29aa419e9d091d4ac17de8fd519926a66490f7fc48b98d0be019f328546
|
|
BLAKE2b-256 checksum How to use checksums |
cea071df4b83d2b90e5fa433f958f70c885d14b42107c28221ff23a595b06175
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / pytest_xhtml-0.6.1-py3-none-any.whl
| Download URL | pytest_xhtml-0.6.1-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
afef0741b3a2d368ea910769fe0fa536b302ddb50232c84d5385b61e81011f58
|
|
BLAKE2b-256 checksum How to use checksums |
0c404f54c6d95ac173d8cb47ea255bf71732ca70008d6a823336268ff4468258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for pytest-xhtml 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.