eric7.Testing.TestResultsTree

Module implementing a tree view and associated model to show the test result data.

Global Attributes

TopLevelId

Classes

TestResultsFilterModel Class implementing a filter model to filter the test results by status.
TestResultsModel Class implementing the item model containing the test data.
TestResultsTreeView Class implementing a tree view to show the test result data.

Functions

None


TestResultsFilterModel

Class implementing a filter model to filter the test results by status.

Derived from

QSortFilterProxyModel

Class Attributes

None

Class Methods

None

Methods

TestResultsFilterModel Constructor
filterAcceptsRow Public method to determine, if the row is acceptable.
setStatusFilterString Public method to set the status filter string.

Static Methods

None

TestResultsFilterModel (Constructor)

TestResultsFilterModel(parent=None)

Constructor

parent (QObject)
reference to the parent object

TestResultsFilterModel.filterAcceptsRow

filterAcceptsRow(sourceRow, sourceParent)

Public method to determine, if the row is acceptable.

sourceRow (int)
row number in the source model
sourceParent (QModelIndex)
index of the source item
Return:
flag indicating acceptance
Return Type:
bool

TestResultsFilterModel.setStatusFilterString

setStatusFilterString(filterString)

Public method to set the status filter string.

filterString (str)
status filter string
Up


TestResultsModel

Class implementing the item model containing the test data.

Signals

summary(str)
emitted whenever the model data changes. The element is a summary of the test results of the model.

Derived from

QAbstractItemModel

Class Attributes

DurationColumn
Headers
MessageColumn
NameColumn
StatusColumn

Class Methods

None

Methods

TestResultsModel Constructor
__summary Private method to generate a test results summary text.
addTestResults Public method to add test results to the ones already managed by the model.
clear Public method to clear the model data.
columnCount Public method to get the number of columns.
data Public method to get the data for the various columns and roles.
durationKey Function to generate a key for duration sorting
getFailedTests Public method to extract the test ids of all failed tests.
getStatusFilterList Public method to get a list of the unique test result status.
getTestResults Public method to get the list of test results managed by the model.
headerData Public method to get the header string for the various sections.
index Public method to generate an index for the given row and column to identify the item.
parent Public method to get the parent of the item pointed to by index.
rowCount Public method to get the number of row for a given parent index.
setTestResults Public method to set the list of test results of the model.
sort Public method to sort the model data by column in order.
updateTestResults Public method to update the data of managed test result items.

Static Methods

None

TestResultsModel (Constructor)

TestResultsModel(parent=None)

Constructor

parent (QObject (optional))
reference to the parent object (defaults to None)

TestResultsModel.__summary

__summary()

Private method to generate a test results summary text.

Return:
test results summary text
Return Type:
str

TestResultsModel.addTestResults

addTestResults(testResults)

Public method to add test results to the ones already managed by the model.

testResults (list of TestResult)
test results to be added to the model

TestResultsModel.clear

clear()

Public method to clear the model data.

TestResultsModel.columnCount

columnCount(parent=QModelIndex())

Public method to get the number of columns.

parent (QModelIndex (optional))
index of the parent item (defaults to QModelIndex())
Return:
number of columns
Return Type:
int

TestResultsModel.data

data(index, role)

Public method to get the data for the various columns and roles.

index (QModelIndex)
index of the data to be returned
role (Qt.ItemDataRole)
role designating the data to return
Return:
requested data item
Return Type:
Any

TestResultsModel.durationKey

durationKey()

Function to generate a key for duration sorting

result (TestResult)
result object
Return:
sort key
Return Type:
float

TestResultsModel.getFailedTests

getFailedTests()

Public method to extract the test ids of all failed tests.

Return:
test ids of all failed tests
Return Type:
list of str

TestResultsModel.getStatusFilterList

getStatusFilterList()

Public method to get a list of the unique test result status.

Return:
test result status
Return Type:
set of str

TestResultsModel.getTestResults

getTestResults()

Public method to get the list of test results managed by the model.

Return:
list of test results managed by the model
Return Type:
list of TestResult

TestResultsModel.headerData

headerData(section, orientation, role=Qt.ItemDataRole.DisplayRole)

Public method to get the header string for the various sections.

section (int)
section number
orientation (Qt.Orientation)
orientation of the header
role (Qt.ItemDataRole (optional))
data role (defaults to Qt.ItemDataRole.DisplayRole)
Return:
header string of the section
Return Type:
str

TestResultsModel.index

index(row, column, parent=QModelIndex())

Public method to generate an index for the given row and column to identify the item.

row (int)
row for the index
column (int)
column for the index
parent (QModelIndex (optional))
index of the parent item (defaults to QModelIndex())
Return:
index for the item
Return Type:
QModelIndex

TestResultsModel.parent

parent(index)

Public method to get the parent of the item pointed to by index.

index (QModelIndex)
index of the item
Return:
index of the parent item
Return Type:
QModelIndex

TestResultsModel.rowCount

rowCount(parent=QModelIndex())

Public method to get the number of row for a given parent index.

parent (QModelIndex (optional))
index of the parent item (defaults to QModelIndex())
Return:
number of rows
Return Type:
int

TestResultsModel.setTestResults

setTestResults(testResults)

Public method to set the list of test results of the model.

testResults (list of TestResult)
test results to be managed by the model

TestResultsModel.sort

sort(column, order)

Public method to sort the model data by column in order.

column (int)
sort column number
order (Qt.SortOrder)
sort order

TestResultsModel.updateTestResults

updateTestResults(testResults)

Public method to update the data of managed test result items.

testResults (list of TestResult)
test results to be updated
Up


TestResultsTreeView

Class implementing a tree view to show the test result data.

Signals

goto(str, int)
emitted to go to the position given by file name and line number

Derived from

QTreeView

Class Attributes

None

Class Methods

None

Methods

TestResultsTreeView Constructor
__canonicalIndex Private method to create the canonical index for a given index.
__createBackgroundContextMenu Private method to create a context menu for the background.
__createContextMenu Private method to create a context menu for the item pointed to by the given index.
__gotoTestDefinition Private slot to show the test definition.
__showContextMenu Private slot to show the context menu.
dataChanged Public method called when the model data has changed.
reset Public method to reset the internal state of the view.
resizeColumns Public method to resize the columns to their contents.
rowsInserted Public method called when rows are inserted.
spanFirstColumn Public method to make the first column span the row for second level items.

Static Methods

None

TestResultsTreeView (Constructor)

TestResultsTreeView(parent=None)

Constructor

parent (QWidget (optional))
reference to the parent widget (defaults to None)

TestResultsTreeView.__canonicalIndex

__canonicalIndex(index)

Private method to create the canonical index for a given index.

The canonical index is the index of the first column of the test result entry (i.e. the top-level item). If the index is invalid, None is returned.

index (QModelIndex)
index to determine the canonical index for
Return:
index of the firt column of the associated top-level item index
Return Type:
QModelIndex

TestResultsTreeView.__createBackgroundContextMenu

__createBackgroundContextMenu()

Private method to create a context menu for the background.

Return:
created context menu
Return Type:
QMenu

TestResultsTreeView.__createContextMenu

__createContextMenu(index)

Private method to create a context menu for the item pointed to by the given index.

index (QModelIndex)
index of the item
Return:
created context menu
Return Type:
QMenu

TestResultsTreeView.__gotoTestDefinition

__gotoTestDefinition(index)

Private slot to show the test definition.

index (QModelIndex)
index for the double-clicked item

TestResultsTreeView.__showContextMenu

__showContextMenu(pos)

Private slot to show the context menu.

pos (QPoint)
relative position for the context menu

TestResultsTreeView.dataChanged

dataChanged(topLeft, bottomRight, roles=[])

Public method called when the model data has changed.

topLeft (QModelIndex)
index of the top left element
bottomRight (QModelIndex)
index of the bottom right element
roles (list of Qt.ItemDataRole (optional))
list of roles changed (defaults to [])

TestResultsTreeView.reset

reset()

Public method to reset the internal state of the view.

TestResultsTreeView.resizeColumns

resizeColumns()

Public method to resize the columns to their contents.

TestResultsTreeView.rowsInserted

rowsInserted(parent, startRow, endRow)

Public method called when rows are inserted.

parent (QModelIndex)
model index of the parent item
startRow (int)
first row been inserted
endRow (int)
last row been inserted

TestResultsTreeView.spanFirstColumn

spanFirstColumn(startRow, endRow)

Public method to make the first column span the row for second level items.

These items contain the test results.

startRow (QModelIndex)
index of the first row to span
endRow (QModelIndex)
index of the last row (including) to span
Up