diff --git a/src/pytest_html/basereport.py b/src/pytest_html/basereport.py index b160e910..e6209682 100644 --- a/src/pytest_html/basereport.py +++ b/src/pytest_html/basereport.py @@ -152,9 +152,10 @@ def _run_count(self): return f"{counts}/{self._report.collected_items} {'tests' if plural else 'test'} done." def _hydrate_data(self, data, cells): + table_len = len(self._report.table_header) for index, cell in enumerate(cells): # extract column name and data if column is sortable - if "sortable" in self._report.table_header[index]: + if index < table_len and "sortable" in self._report.table_header[index]: name_match = re.search(r"col-(\w+)", cell) data_match = re.search(r"