--- a/src/eric7/Testing/TestResultsTree.py Fri May 05 18:16:57 2023 +0200 +++ b/src/eric7/Testing/TestResultsTree.py Sat May 06 15:15:27 2023 +0200 @@ -84,6 +84,7 @@ } self.__testResults = [] + self.__testResultsById = {} def index(self, row, column, parent=QModelIndex()): """ @@ -250,6 +251,7 @@ """ self.beginResetModel() self.__testResults.clear() + self.__testResultsById.clear() self.endResetModel() self.summary.emit("") @@ -307,6 +309,9 @@ """ self.beginResetModel() self.__testResults = copy.deepcopy(testResults) + self.__testResultsById.clear() + for testResult in testResults: + self.__testResultsById[testResult.id] = testResult self.endResetModel() self.summary.emit(self.__summary()) @@ -323,6 +328,8 @@ lastRow = firstRow + len(testResults) - 1 self.beginInsertRows(QModelIndex(), firstRow, lastRow) self.__testResults.extend(testResults) + for testResult in testResults: + self.__testResultsById[testResult.id] = testResult self.endInsertRows() self.summary.emit(self.__summary()) @@ -340,17 +347,18 @@ testResultsToBeAdded = [] for testResult in testResults: - for index, currentResult in enumerate(self.__testResults): - if currentResult.id == testResult.id: - self.__testResults[index] = testResult - if minIndex is None: - minIndex = index - maxIndex = index - else: - minIndex = min(minIndex, index) - maxIndex = max(maxIndex, index) + if testResult.id in self.__testResultsById: + result = self.__testResultsById[testResult.id] + index = self.__testResults.index(result) + self.__testResults[index] = testResult + self.__testResultsById[testResult.id] = testResult + if minIndex is None: + minIndex = index + maxIndex = index + else: + minIndex = min(minIndex, index) + maxIndex = max(maxIndex, index) - break else: # Test result with given id was not found. # Just add it to the list (could be a sub test) @@ -474,7 +482,6 @@ """ super().rowsInserted(parent, startRow, endRow) - self.resizeColumns() self.spanFirstColumn(startRow, endRow) def dataChanged(self, topLeft, bottomRight, roles=[]): @@ -490,7 +497,6 @@ """ super().dataChanged(topLeft, bottomRight, roles) - self.resizeColumns() while topLeft.parent().isValid(): topLeft = topLeft.parent() while bottomRight.parent().isValid():