{"id":8532,"library":"pytest-html-merger","title":"Pytest HTML Report Merger","description":"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.","status":"active","version":"0.1.0","language":"en","source_language":"en","source_url":"https://github.com/akavbathen/pytest_html_merger.git","tags":["pytest","html","report","merge","testing","utility"],"install":[{"cmd":"pip install pytest-html-merger","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"The utility processes HTML reports generated specifically by the pytest-html plugin, making it a prerequisite for creating input files.","package":"pytest-html","optional":false},{"reason":"Likely used internally for parsing and manipulating HTML content from the input reports to create a merged output.","package":"beautifulsoup4"}],"imports":[],"quickstart":{"code":"# 1. Generate individual HTML reports with pytest-html\n# Assuming you have tests in 'my_tests' directory\npytest my_tests/test_a.py --html=report_a.html\npytest my_tests/test_b.py --html=report_b.html\n\n# 2. Merge the reports using pytest-html-merger\npytest_html_merger report_a.html report_b.html -o merged_report.html --title \"My Combined Test Results\"\n\n# Or merge all HTML files in a directory\n# Assuming reports are in a 'reports' directory\n# mkdir reports && mv report_a.html report_b.html reports/\n# pytest_html_merger -i reports -o merged_reports_from_dir.html","lang":"bash","description":"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."},"warnings":[{"fix":"Use the command-line interface provided. To automate, wrap the command in a shell script or use Python's `subprocess` module.","message":"The 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.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Ensure that your `pytest-html` reports are generated with the `--self-contained-html` flag (e.g., `pytest --html=report.html --self-contained-html`).","message":"The 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.","severity":"gotcha","affected_versions":"0.1.0"},{"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`.","message":"The 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.","severity":"gotcha","affected_versions":"0.1.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install pytest-html-merger` to install the package. Ensure your virtual environment is activated if you are using one.","cause":"The `pytest-html-merger` package is either not installed, or the environment where it was installed is not active/in your system's PATH.","error":"command 'pytest_html_merger' not found"},{"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`).","cause":"The `pytest_html_merger` command was executed without specifying any input HTML files via positional arguments or input directories using the `-i` flag.","error":"ValueError: No HTML files provided. Use -i or pass individual files."},{"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`).","cause":"This often occurs if the input HTML reports were generated without embedding their CSS, and the merger expects self-contained reports.","error":"The merged HTML report appears unstyled or with missing elements."}]}