-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing data in HTML report table after upgrading to pytest-html 4.1.1 #849
Comments
Could you create a small reproducible example? Also, please dump any output in the browser console here. Thanks 🙏🏼 |
Example unit test: import pytest
@pytest.mark.tags('html_report')
def test_failing_example():
assert 1 == 2` conftest.py import pytest
@pytest.hookimpl(tryfirst=True)
def pytest_html_results_table_header(cells):
cells.insert(3, html.th("snapshot", class_="sortable", col="snapshot"))
@pytest.hookimpl(tryfirst=True)
def pytest_html_results_table_row(report, cells):
#code
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_htmlreport(item,call):
outcome = yield
# code Run command : python run.py —tags=html_report - with tags -issues with latest version4.1.1, But when i downgraded to 3.2.0 got html table table with data as expected. python run.py tests/test_pytest_html.py - without tags -no issues with both the versions **Got INTERNALERROR : ** `INTERNALERROR> File ".nox/tests/lib/python3.10/site-packages/pytest_html/basereport.py", line 245, in pytest_runtest_logreport INTERNALERROR> self._process_report(each, dur) INTERNALERROR> File ".nox/tests/lib/python3.10/site-packages/pytest_html/basereport.py", line 283, in _process_report INTERNALERROR> self._hydrate_data(data, cells) INTERNALERROR> File ".nox/tests/lib/python3.10/site-packages/pytest_html/basereport.py", line 159, in _hydrate_data INTERNALERROR> if "sortable" in self._report.table_header[index]: INTERNALERROR> IndexError: list index out of range` I'm suspecting the way to invoking this pytest_html_results_table_header while run the tests with tags is changed in the latest version |
What is What happens if you run it with Where does the |
I am experiencing the same behavior when I run with pytest as well... Pytest command :
these tags were configured in another file
I'm suspecting this issue is with the pytest_html_results_table_header hook after upgrading to pytest-html 4.1.1. In version 3.2.0, this hook was called during pytest_sessionfinish, but it now appears to be called during pytest_sessionstart in the latest version. But the pytest_sessionstart itself is not invoked. Could you please suggest how to invoke pytest_sessionstart from my current setup, and also let me know if I can customize the HTML report header in any other way? |
I am also facing the same issue as pytest_html_results_table_header and pytest_html_report_title fixtures get called first instead of at the end of the session while generating report. |
Hi Team,
I'm currently encountering a problem with pytest-html after upgrading from version 3.2.0 to 4.1.1. My HTML reports are now empty when running tagged tests, although untagged tests generate reports correctly.
Environment: Python version: 3.10 pytest version: 7.4.4 pytest-html version: 4.1.1 (previously 3.2.0)
I'm suspecting since pytest_html_results_table_header hook is not invoking in pytest-html 4.1.1 when running tests with tags. With pytest_html_results_table_header hook I’m trying to insert a snapshot column for failed test , since the table is not properly customized I'm getting an empty report. This hook was invoked in the previous version and is still invoking in 4.1.1 when running tests without tags. The lack of this hook prevents proper table customization, resulting in an empty table.
Observed Behavior: The HTML report's results table is empty when running the tests with tags.
Expected Behavior: The results table should display all test results (name, outcome, duration), including the newer column 'snapshot' when running the tests with tags.
If you have a moment, I'd appreciate your help.
The text was updated successfully, but these errors were encountered: