src/eric7/Testing/TestingWidget.py

branch
eric7
changeset 10404
f7d9c31f0c38
parent 10373
093dcebe5ecb
child 10405
df7e1694d0eb
equal deleted inserted replaced
10403:ea3320d5e8e9 10404:f7d9c31f0c38
31 ) 31 )
32 32
33 from .Interfaces import Frameworks 33 from .Interfaces import Frameworks
34 from .Interfaces.TestExecutorBase import TestConfig, TestResult, TestResultCategory 34 from .Interfaces.TestExecutorBase import TestConfig, TestResult, TestResultCategory
35 from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry 35 from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry
36 from .TestResultsTree import TestResultsModel, TestResultsTreeView 36 from .TestResultsTree import TestResultsFilterModel, TestResultsModel, TestResultsTreeView
37 from .Ui_TestingWidget import Ui_TestingWidget 37 from .Ui_TestingWidget import Ui_TestingWidget
38 38
39 39
40 class TestingWidgetModes(enum.Enum): 40 class TestingWidgetModes(enum.Enum):
41 """ 41 """
71 super().__init__(parent) 71 super().__init__(parent)
72 self.setupUi(self) 72 self.setupUi(self)
73 73
74 self.__resultsModel = TestResultsModel(self) 74 self.__resultsModel = TestResultsModel(self)
75 self.__resultsModel.summary.connect(self.__setStatusLabel) 75 self.__resultsModel.summary.connect(self.__setStatusLabel)
76 self.__resultFilterModel = TestResultsFilterModel(self)
77 self.__resultFilterModel.setSourceModel(self.__resultsModel)
76 self.__resultsTree = TestResultsTreeView(self) 78 self.__resultsTree = TestResultsTreeView(self)
77 self.__resultsTree.setModel(self.__resultsModel) 79 self.__resultsTree.setModel(self.__resultFilterModel)
78 self.__resultsTree.goto.connect(self.__showSource) 80 self.__resultsTree.goto.connect(self.__showSource)
79 self.resultsGroupBox.layout().addWidget(self.__resultsTree) 81 self.resultsGroupBox.layout().addWidget(self.__resultsTree)
80 82
81 self.versionsButton.setIcon(EricPixmapCache.getIcon("info")) 83 self.versionsButton.setIcon(EricPixmapCache.getIcon("info"))
82 self.clearHistoriesButton.setIcon(EricPixmapCache.getIcon("clearPrivateData")) 84 self.clearHistoriesButton.setIcon(EricPixmapCache.getIcon("clearPrivateData"))
96 98
97 self.testComboBox.completer().setCaseSensitivity( 99 self.testComboBox.completer().setCaseSensitivity(
98 Qt.CaseSensitivity.CaseSensitive 100 Qt.CaseSensitivity.CaseSensitive
99 ) 101 )
100 self.testComboBox.lineEdit().setClearButtonEnabled(True) 102 self.testComboBox.lineEdit().setClearButtonEnabled(True)
103
104 self.__allFilter = self.tr("<all>")
101 105
102 # create some more dialog buttons for orchestration 106 # create some more dialog buttons for orchestration
103 self.__showLogButton = self.buttonBox.addButton( 107 self.__showLogButton = self.buttonBox.addButton(
104 self.tr("Show Output..."), QDialogButtonBox.ButtonRole.ActionRole 108 self.tr("Show Output..."), QDialogButtonBox.ButtonRole.ActionRole
105 ) 109 )
930 category=TestResultCategory.PENDING, 934 category=TestResultCategory.PENDING,
931 status=self.tr("pending"), 935 status=self.tr("pending"),
932 name=name, 936 name=name,
933 id=id, 937 id=id,
934 message=desc, 938 message=desc,
935 ) 939 filename=filename,
936 for id, name, desc in testNames 940 lineno=lineno,
941 )
942 for id, name, desc, filename, lineno in testNames
937 ] 943 ]
938 self.__resultsModel.addTestResults(testResults) 944 self.__resultsModel.addTestResults(testResults)
939 self.__resultsTree.resizeColumns() 945 self.__resultsTree.resizeColumns()
940 946
941 self.__totalCount += len(testResults) 947 self.__totalCount += len(testResults)
1027 1033
1028 self.__setStoppedMode() 1034 self.__setStoppedMode()
1029 self.__testExecutor = None 1035 self.__testExecutor = None
1030 1036
1031 self.__adjustPendingState() 1037 self.__adjustPendingState()
1038 self.__updateStatusFilterComboBox()
1032 1039
1033 @pyqtSlot(int, float) 1040 @pyqtSlot(int, float)
1034 def __testRunFinished(self, noTests, duration): 1041 def __testRunFinished(self, noTests, duration):
1035 """ 1042 """
1036 Private slot to handle the 'testRunFinished' signal of the executor. 1043 Private slot to handle the 'testRunFinished' signal of the executor.
1062 """ 1069 """
1063 Private slot to handle the 'testRunAboutToBeStarted' signal of the 1070 Private slot to handle the 'testRunAboutToBeStarted' signal of the
1064 executor. 1071 executor.
1065 """ 1072 """
1066 self.__resultsModel.clear() 1073 self.__resultsModel.clear()
1074 self.statusFilterComboBox.clear()
1067 1075
1068 def __adjustPendingState(self): 1076 def __adjustPendingState(self):
1069 """ 1077 """
1070 Private method to change the status indicator of all still pending 1078 Private method to change the status indicator of all still pending
1071 tests to "not run". 1079 tests to "not run".
1199 event.accept() 1207 event.accept()
1200 1208
1201 for editor in self.__editors: 1209 for editor in self.__editors:
1202 with contextlib.suppress(RuntimeError): 1210 with contextlib.suppress(RuntimeError):
1203 editor.close() 1211 editor.close()
1212
1213 @pyqtSlot(str)
1214 def on_statusFilterComboBox_currentTextChanged(self, status):
1215 """
1216 Private slot handling the selection of a status for items to be shown.
1217
1218 @param status selected status
1219 @type str
1220 """
1221 # TODO: not yet implemented
1222 if status == self.__allFilter:
1223 status = ""
1224
1225 self.__resultFilterModel.setStatusFilterString(status)
1226
1227 def __updateStatusFilterComboBox(self):
1228 statusFilters = self.__resultsModel.getStatusFilterList()
1229 self.statusFilterComboBox.clear()
1230 self.statusFilterComboBox.addItem(self.__allFilter)
1231 self.statusFilterComboBox.addItems(sorted(statusFilters))
1204 1232
1205 1233
1206 class TestingWindow(EricMainWindow): 1234 class TestingWindow(EricMainWindow):
1207 """ 1235 """
1208 Main window class for the standalone dialog. 1236 Main window class for the standalone dialog.

eric ide

mercurial