41 @signal unittestStopped() emitted after a unit test was run |
41 @signal unittestStopped() emitted after a unit test was run |
42 """ |
42 """ |
43 unittestFile = pyqtSignal(str, int, bool) |
43 unittestFile = pyqtSignal(str, int, bool) |
44 unittestStopped = pyqtSignal() |
44 unittestStopped = pyqtSignal() |
45 |
45 |
46 TestCaseNameRole = Qt.UserRole |
46 TestCaseNameRole = Qt.ItemDataRole.UserRole |
47 TestCaseFileRole = Qt.UserRole + 1 |
47 TestCaseFileRole = Qt.ItemDataRole.UserRole + 1 |
48 |
48 |
49 ErrorsInfoRole = Qt.UserRole |
49 ErrorsInfoRole = Qt.ItemDataRole.UserRole |
50 |
50 |
51 SkippedColorDarkTheme = QColor("#00aaff") |
51 SkippedColorDarkTheme = QColor("#00aaff") |
52 FailedExpectedColorDarkTheme = QColor("#ccaaff") |
52 FailedExpectedColorDarkTheme = QColor("#ccaaff") |
53 SucceededUnexpectedColorDarkTheme = QColor("#ff99dd") |
53 SucceededUnexpectedColorDarkTheme = QColor("#ff99dd") |
54 SkippedColorLightTheme = QColor("#0000ff") |
54 SkippedColorLightTheme = QColor("#0000ff") |
75 if name: |
75 if name: |
76 self.setObjectName(name) |
76 self.setObjectName(name) |
77 self.setupUi(self) |
77 self.setupUi(self) |
78 |
78 |
79 self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode) |
79 self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode) |
80 self.testsuitePicker.setInsertPolicy(QComboBox.InsertAtTop) |
80 self.testsuitePicker.setInsertPolicy( |
|
81 QComboBox.InsertPolicy.InsertAtTop) |
81 self.testsuitePicker.setSizeAdjustPolicy( |
82 self.testsuitePicker.setSizeAdjustPolicy( |
82 QComboBox.AdjustToMinimumContentsLength) |
83 QComboBox.SizeAdjustPolicy.AdjustToContents) |
83 |
84 |
84 self.discoveryPicker.setMode(E5PathPickerModes.DirectoryMode) |
85 self.discoveryPicker.setMode(E5PathPickerModes.DirectoryMode) |
85 self.discoveryPicker.setInsertPolicy(QComboBox.InsertAtTop) |
86 self.discoveryPicker.setInsertPolicy( |
|
87 QComboBox.InsertPolicy.InsertAtTop) |
86 self.discoveryPicker.setSizeAdjustPolicy( |
88 self.discoveryPicker.setSizeAdjustPolicy( |
87 QComboBox.AdjustToMinimumContentsLength) |
89 QComboBox.SizeAdjustPolicy.AdjustToContents) |
88 |
90 |
89 self.discoverButton = self.buttonBox.addButton( |
91 self.discoverButton = self.buttonBox.addButton( |
90 self.tr("Discover"), QDialogButtonBox.ActionRole) |
92 self.tr("Discover"), QDialogButtonBox.ButtonRole.ActionRole) |
91 self.discoverButton.setToolTip(self.tr( |
93 self.discoverButton.setToolTip(self.tr( |
92 "Discover tests")) |
94 "Discover tests")) |
93 self.discoverButton.setWhatsThis(self.tr( |
95 self.discoverButton.setWhatsThis(self.tr( |
94 """<b>Discover</b>""" |
96 """<b>Discover</b>""" |
95 """<p>This button starts a discovery of available tests.</p>""")) |
97 """<p>This button starts a discovery of available tests.</p>""")) |
96 self.startButton = self.buttonBox.addButton( |
98 self.startButton = self.buttonBox.addButton( |
97 self.tr("Start"), QDialogButtonBox.ActionRole) |
99 self.tr("Start"), QDialogButtonBox.ButtonRole.ActionRole) |
98 self.startButton.setToolTip(self.tr( |
100 self.startButton.setToolTip(self.tr( |
99 "Start the selected testsuite")) |
101 "Start the selected testsuite")) |
100 self.startButton.setWhatsThis(self.tr( |
102 self.startButton.setWhatsThis(self.tr( |
101 """<b>Start Test</b>""" |
103 """<b>Start Test</b>""" |
102 """<p>This button starts the selected testsuite.</p>""")) |
104 """<p>This button starts the selected testsuite.</p>""")) |
103 self.startFailedButton = self.buttonBox.addButton( |
105 self.startFailedButton = self.buttonBox.addButton( |
104 self.tr("Rerun Failed"), QDialogButtonBox.ActionRole) |
106 self.tr("Rerun Failed"), QDialogButtonBox.ButtonRole.ActionRole) |
105 self.startFailedButton.setToolTip( |
107 self.startFailedButton.setToolTip( |
106 self.tr("Reruns failed tests of the selected testsuite")) |
108 self.tr("Reruns failed tests of the selected testsuite")) |
107 self.startFailedButton.setWhatsThis(self.tr( |
109 self.startFailedButton.setWhatsThis(self.tr( |
108 """<b>Rerun Failed</b>""" |
110 """<b>Rerun Failed</b>""" |
109 """<p>This button reruns all failed tests of the selected""" |
111 """<p>This button reruns all failed tests of the selected""" |
110 """ testsuite.</p>""")) |
112 """ testsuite.</p>""")) |
111 self.stopButton = self.buttonBox.addButton( |
113 self.stopButton = self.buttonBox.addButton( |
112 self.tr("Stop"), QDialogButtonBox.ActionRole) |
114 self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole) |
113 self.stopButton.setToolTip(self.tr("Stop the running unittest")) |
115 self.stopButton.setToolTip(self.tr("Stop the running unittest")) |
114 self.stopButton.setWhatsThis(self.tr( |
116 self.stopButton.setWhatsThis(self.tr( |
115 """<b>Stop Test</b>""" |
117 """<b>Stop Test</b>""" |
116 """<p>This button stops a running unittest.</p>""")) |
118 """<p>This button stops a running unittest.</p>""")) |
117 self.discoverButton.setEnabled(False) |
119 self.discoverButton.setEnabled(False) |
547 [testPath[index - 1]]) |
549 [testPath[index - 1]]) |
548 else: |
550 else: |
549 itm = QTreeWidgetItem(pitm, |
551 itm = QTreeWidgetItem(pitm, |
550 [testPath[index - 1]]) |
552 [testPath[index - 1]]) |
551 pitm.setExpanded(True) |
553 pitm.setExpanded(True) |
552 itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) |
554 itm.setFlags(Qt.ItemFlag.ItemIsUserCheckable | |
553 itm.setCheckState(0, Qt.Unchecked) |
555 Qt.ItemFlag.ItemIsEnabled) |
|
556 itm.setCheckState(0, Qt.CheckState.Unchecked) |
554 itm.setData(0, UnittestDialog.TestCaseNameRole, modulePath) |
557 itm.setData(0, UnittestDialog.TestCaseNameRole, modulePath) |
555 if ( |
558 if ( |
556 os.path.splitext(os.path.basename(filename))[0] == |
559 os.path.splitext(os.path.basename(filename))[0] == |
557 itm.text(0) |
560 itm.text(0) |
558 ): |
561 ): |
576 selectedTests = [] |
579 selectedTests = [] |
577 if parent is None: |
580 if parent is None: |
578 # top level |
581 # top level |
579 for index in range(self.discoveryList.topLevelItemCount()): |
582 for index in range(self.discoveryList.topLevelItemCount()): |
580 itm = self.discoveryList.topLevelItem(index) |
583 itm = self.discoveryList.topLevelItem(index) |
581 if itm.checkState(0) == Qt.Checked: |
584 if itm.checkState(0) == Qt.CheckState.Checked: |
582 selectedTests.append( |
585 selectedTests.append( |
583 itm.data(0, UnittestDialog.TestCaseNameRole)) |
586 itm.data(0, UnittestDialog.TestCaseNameRole)) |
584 # ignore children because they are included implicitly |
587 # ignore children because they are included implicitly |
585 elif itm.childCount(): |
588 elif itm.childCount(): |
586 # recursively check children |
589 # recursively check children |
588 |
591 |
589 else: |
592 else: |
590 # parent item with children |
593 # parent item with children |
591 for index in range(parent.childCount()): |
594 for index in range(parent.childCount()): |
592 itm = parent.child(index) |
595 itm = parent.child(index) |
593 if itm.checkState(0) == Qt.Checked: |
596 if itm.checkState(0) == Qt.CheckState.Checked: |
594 selectedTests.append( |
597 selectedTests.append( |
595 itm.data(0, UnittestDialog.TestCaseNameRole)) |
598 itm.data(0, UnittestDialog.TestCaseNameRole)) |
596 # ignore children because they are included implicitly |
599 # ignore children because they are included implicitly |
597 elif itm.childCount(): |
600 elif itm.childCount(): |
598 # recursively check children |
601 # recursively check children |
1154 ui = Ui_UnittestStacktraceDialog() |
1157 ui = Ui_UnittestStacktraceDialog() |
1155 ui.setupUi(self.dlg) |
1158 ui.setupUi(self.dlg) |
1156 self.dlg.traceback = ui.traceback |
1159 self.dlg.traceback = ui.traceback |
1157 |
1160 |
1158 ui.showButton = ui.buttonBox.addButton( |
1161 ui.showButton = ui.buttonBox.addButton( |
1159 self.tr("Show Source"), QDialogButtonBox.ActionRole) |
1162 self.tr("Show Source"), QDialogButtonBox.ButtonRole.ActionRole) |
1160 ui.showButton.clicked.connect(self.__showSource) |
1163 ui.showButton.clicked.connect(self.__showSource) |
1161 |
1164 |
1162 ui.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
1165 ui.buttonBox.button( |
|
1166 QDialogButtonBox.StandardButton.Close).setDefault(True) |
1163 |
1167 |
1164 self.dlg.setWindowTitle(text) |
1168 self.dlg.setWindowTitle(text) |
1165 ui.testLabel.setText(test) |
1169 ui.testLabel.setText(test) |
1166 ui.traceback.setPlainText(tracebackText) |
1170 ui.traceback.setPlainText(tracebackText) |
1167 |
1171 |