Registry / testing / pytest-html-merger

pytest-html-merger

JSON →
library0.1.0pypypiunverified

pytest-html-merger is a utility designed to combine multiple HTML reports generated by the pytest-html plugin into a single, unified HTML report. It is currently at version 0.1.0 and is maintained with an active development cadence, with its latest release in July 2024.

pip install pytest-html-merger
INSTALL
IMPORT
SIG · PYTEST-HTML-MERGER
P
pytest-html-merger
testingpythonv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

First, generate individual HTML reports using the `pytest-html` plugin. Then, use the `pytest_html_merger` command-line tool, specifying input files or directories and an output file.

# 1. Generate individual HTML reports with pytest-html # Assuming you have tests in 'my_tests' directory pytest my_tests/test_a.py --html=report_a.html pytest my_tests/test_b.py --html=report_b.html # 2. Merge the reports using pytest-html-merger pytest_html_merger report_a.html report_b.html -o merged_report.html --title "My Combined Test Results" # Or merge all HTML files in a directory # Assuming reports are in a 'reports' directory # mkdir reports && mv report_a.html report_b.html reports/ # pytest_html_merger -i reports -o merged_reports_from_dir.html
pytest-html-merger --version
Debug
Known issues
gotchaThe utility primarily operates as a command-line tool and does not expose a public Python API for direct programmatic integration into other Python scripts. Users expecting a Python module to import and call functions will find this to be a limitation.
fix
Use the command-line interface provided. To automate, wrap the command in a shell script or use Python's `subprocess` module.
affects: 0.1.0
gotchaThe merger assumes that the input pytest HTML reports have their CSS embedded (self-contained). If reports are generated with external CSS files, the merged report may appear unstyled or broken, as the external references might not be correctly resolved.
fix
Ensure that your `pytest-html` reports are generated with the `--self-contained-html` flag (e.g., `pytest --html=report.html --self-contained-html`).
affects: 0.1.0
gotchaThe tool's functionality is dependent on the internal structure of reports generated by `pytest-html`. Future breaking changes in `pytest-html`'s report format could potentially impact the `pytest-html-merger`'s ability to combine reports correctly.
fix
Monitor `pytest-html` release notes for breaking changes related to report structure. If issues arise after a `pytest-html` update, consider pinning `pytest-html` to an older compatible version or checking for updates to `pytest-html-merger`.
affects: 0.1.0
Errors
Common errors & fixes
command 'pytest_html_merger' not found
The `pytest-html-merger` package is either not installed, or the environment where it was installed is not active/in your system's PATH.
fix
Run `pip install pytest-html-merger` to install the package. Ensure your virtual environment is activated if you are using one.
ValueError: No HTML files provided. Use -i or pass individual files.
The `pytest_html_merger` command was executed without specifying any input HTML files via positional arguments or input directories using the `-i` flag.
fix
Provide the path to individual HTML report files (e.g., `pytest_html_merger report1.html report2.html -o merged.html`) or specify an input directory (e.g., `pytest_html_merger -i ./reports -o merged.html`).
The merged HTML report appears unstyled or with missing elements.
This often occurs if the input HTML reports were generated without embedding their CSS, and the merger expects self-contained reports.
fix
Regenerate your individual pytest HTML reports using the `--self-contained-html` flag with `pytest-html` (e.g., `pytest --html=report.html --self-contained-html`).
Upgrade
Version history
0.1.0latest on PyPI · released Jul 12, 2024
Audit
Dependencies
pytest-htmlrequiredThe utility processes HTML reports generated specifically by the pytest-html plugin, making it a prerequisite for creating input files.
beautifulsoup4requiredLikely used internally for parsing and manipulating HTML content from the input reports to create a merged output.
Agent activity
6 hits · last 30 days
node
6
Resources
pytest-html-merger — pip install pytest-html-merger · libregistry