Tue, 14 Jan 2025 17:29:56 +0100
Merged with branch 'eric7' in order to prepare a new release.
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11006
diff
changeset
|
3 | # Copyright (c) 2022 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a widget to orchestrate unit test execution. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
10 | import contextlib |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import enum |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
12 | import locale |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | import os |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
10442 | 15 | from PyQt6.QtCore import QCoreApplication, QEvent, QPoint, Qt, pyqtSignal, pyqtSlot |
10405 | 16 | from PyQt6.QtWidgets import ( |
17 | QAbstractButton, | |
18 | QComboBox, | |
19 | QDialogButtonBox, | |
10442 | 20 | QMenu, |
10405 | 21 | QTreeWidgetItem, |
22 | QWidget, | |
23 | ) | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10766
diff
changeset
|
25 | from eric7 import EricUtilities, Preferences |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
26 | from eric7.DataViews.PyCoverageDialog import PyCoverageDialog |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
27 | from eric7.EricGui import EricPixmapCache |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
28 | from eric7.EricWidgets import EricMessageBox |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
29 | from eric7.EricWidgets.EricApplication import ericApp |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
30 | from eric7.EricWidgets.EricMainWindow import EricMainWindow |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
31 | from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
32 | from eric7.Globals import ( |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
33 | recentNameTestDiscoverHistory, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
34 | recentNameTestEnvironment, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
35 | recentNameTestFileHistory, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
36 | recentNameTestFramework, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
37 | recentNameTestNameHistory, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
38 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | from .Interfaces import Frameworks |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | from .Interfaces.TestExecutorBase import TestConfig, TestResult, TestResultCategory |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
42 | from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry |
10405 | 43 | from .TestResultsTree import ( |
44 | TestResultsFilterModel, | |
45 | TestResultsModel, | |
46 | TestResultsTreeView, | |
47 | ) | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9462
diff
changeset
|
48 | from .Ui_TestingWidget import Ui_TestingWidget |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
51 | class TestingWidgetModes(enum.Enum): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
53 | Class defining the various modes of the testing widget. |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | IDLE = 0 # idle, no test were run yet |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | RUNNING = 1 # test run being performed |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | STOPPED = 2 # test run finished |
10405 | 59 | DISCOVERY = 3 # discovery of tests being performed |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
62 | class TestingWidget(QWidget, Ui_TestingWidget): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | Class implementing a widget to orchestrate unit test execution. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
66 | @signal testFile(str, int, bool) emitted to show the source of a |
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
67 | test file |
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
68 | @signal testRunStopped() emitted after a test run has finished |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
71 | testFile = pyqtSignal(str, int, bool) |
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
72 | testRunStopped = pyqtSignal() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | |
10405 | 74 | TestCaseNameRole = Qt.ItemDataRole.UserRole |
75 | TestCaseFileRole = Qt.ItemDataRole.UserRole + 1 | |
76 | TestCaseLinenoRole = Qt.ItemDataRole.UserRole + 2 | |
77 | TestCaseIdRole = Qt.ItemDataRole.UserRole + 3 | |
78 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | def __init__(self, testfile=None, parent=None): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | @param testfile file name of the test to load |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | @param parent reference to the parent widget (defaults to None) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | @type QWidget (optional) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | super().__init__(parent) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.__resultsModel = TestResultsModel(self) |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
92 | self.__resultsModel.summary.connect(self.__setStatusLabel) |
10404 | 93 | self.__resultFilterModel = TestResultsFilterModel(self) |
94 | self.__resultFilterModel.setSourceModel(self.__resultsModel) | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | self.__resultsTree = TestResultsTreeView(self) |
10404 | 96 | self.__resultsTree.setModel(self.__resultFilterModel) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
97 | self.__resultsTree.goto.connect(self.__showSource) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.resultsGroupBox.layout().addWidget(self.__resultsTree) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
100 | self.versionsButton.setIcon(EricPixmapCache.getIcon("info")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
101 | self.clearHistoriesButton.setIcon(EricPixmapCache.getIcon("clearPrivateData")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
102 | self.showMarkersButton.setIcon(EricPixmapCache.getIcon("select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
103 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.testsuitePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | self.testsuitePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | self.testsuitePicker.setSizeAdjustPolicy( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
107 | QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
108 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | self.discoveryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | self.discoveryPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | self.discoveryPicker.setSizeAdjustPolicy( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | |
10217
7888177e7463
Fixed in issue with several editable combo box selectors, that the value could not be changed if the edited text differed by case only. This was caused by the standard QComboBox completer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10020
diff
changeset
|
116 | self.testComboBox.completer().setCaseSensitivity( |
7888177e7463
Fixed in issue with several editable combo box selectors, that the value could not be changed if the edited text differed by case only. This was caused by the standard QComboBox completer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10020
diff
changeset
|
117 | Qt.CaseSensitivity.CaseSensitive |
7888177e7463
Fixed in issue with several editable combo box selectors, that the value could not be changed if the edited text differed by case only. This was caused by the standard QComboBox completer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10020
diff
changeset
|
118 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.testComboBox.lineEdit().setClearButtonEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
120 | |
10404 | 121 | self.__allFilter = self.tr("<all>") |
122 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | # create some more dialog buttons for orchestration |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
124 | self.__showLogButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
125 | self.tr("Show Output..."), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | ) |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
127 | self.__showLogButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | self.tr("Show the output of the test runner process") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
129 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
130 | self.__showLogButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
132 | """<b>Show Output...</b""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
133 | """<p>This button opens a dialog containing the output of the""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
134 | """ test runner process of the most recent run.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
135 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
137 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
138 | self.__showCoverageButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
139 | self.tr("Show Coverage..."), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
140 | ) |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
141 | self.__showCoverageButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | self.tr("Show code coverage in a new dialog") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | self.__showCoverageButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
145 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
146 | """<b>Show Coverage...</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
147 | """<p>This button opens a dialog containing the collected code""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
148 | """ coverage data.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
149 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
150 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
151 | |
10405 | 152 | self.__discoverButton = self.buttonBox.addButton( |
153 | self.tr("Discover"), QDialogButtonBox.ButtonRole.ActionRole | |
154 | ) | |
155 | self.__discoverButton.setToolTip(self.tr("Discover Tests")) | |
156 | self.__discoverButton.setWhatsThis( | |
157 | self.tr( | |
158 | """<b>Discover Tests</b>""" | |
159 | """<p>This button starts a discovery of available tests.</p>""" | |
160 | ) | |
161 | ) | |
162 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | self.__startButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
164 | self.tr("Start"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
166 | |
10405 | 167 | self.__startButton.setToolTip(self.tr("Start the selected test suite")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | self.__startButton.setWhatsThis( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
169 | self.tr("""<b>Start Test</b><p>This button starts the test run.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
170 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
171 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
172 | self.__startFailedButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
173 | self.tr("Rerun Failed"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
174 | ) |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
175 | self.__startFailedButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
176 | self.tr("Reruns failed tests of the selected testsuite") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
177 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
178 | self.__startFailedButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | """<b>Rerun Failed</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
181 | """<p>This button reruns all failed tests of the most recent""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | """ test run.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
185 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | self.__stopButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | self.tr("Stop"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
188 | ) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
189 | self.__stopButton.setToolTip(self.tr("Stop the running test")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | self.__stopButton.setWhatsThis( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
191 | self.tr("""<b>Stop Test</b><p>This button stops a running test.</p>""") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
192 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self.setWindowFlags( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
195 | self.windowFlags() | Qt.WindowType.WindowContextHelpButtonHint |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | ) |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
197 | self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
198 | self.setWindowTitle(self.tr("Testing")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
199 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
200 | try: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
201 | # we are called from within the eric IDE |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
202 | self.__venvManager = ericApp().getObject("VirtualEnvManager") |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
203 | self.__project = ericApp().getObject("Project") |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
204 | self.__project.projectOpened.connect(self.__projectOpened) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
205 | self.__project.projectClosed.connect(self.__projectClosed) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
206 | except KeyError: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
207 | # we were called as a standalone application |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
208 | from eric7.VirtualEnv.VirtualenvManager import ( # __IGNORE_WARNING_I101__ |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
209 | VirtualenvManager, |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
210 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
212 | self.__venvManager = VirtualenvManager(self) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
213 | self.__venvManager.virtualEnvironmentAdded.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
214 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
215 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
216 | self.__venvManager.virtualEnvironmentRemoved.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
217 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
218 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
219 | self.__venvManager.virtualEnvironmentChanged.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
220 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
221 | ) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
222 | ericApp().registerObject("VirtualEnvManager", self.__venvManager) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
223 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
224 | self.__project = None |
10415 | 225 | |
226 | self.debuggerCheckBox.setChecked(False) | |
227 | self.debuggerCheckBox.setVisible(False) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | self.__discoverHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | self.__fileHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | self.__testNameHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | self.__recentFramework = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | self.__recentEnvironment = "" |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
234 | self.__failedTests = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
235 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
236 | self.__coverageFile = "" |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
237 | self.__coverageDialog = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | self.__editors = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | self.__testExecutor = None |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
241 | self.__recentLog = "" |
10452 | 242 | self.__projectString = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
243 | |
9311 | 244 | self.__markersWindow = None |
245 | ||
10442 | 246 | self.__discoveryListContextMenu = QMenu(self.discoveryList) |
247 | self.__discoveryListContextMenu.addAction( | |
248 | self.tr("Collapse All"), self.discoveryList.collapseAll | |
249 | ) | |
250 | self.__discoveryListContextMenu.addAction( | |
251 | self.tr("Expand All"), self.discoveryList.expandAll | |
252 | ) | |
253 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | # connect some signals |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
255 | self.discoveryPicker.editTextChanged.connect(self.__resetResults) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
256 | self.testsuitePicker.editTextChanged.connect(self.__resetResults) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
257 | self.testComboBox.editTextChanged.connect(self.__resetResults) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
258 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
259 | self.__frameworkRegistry = TestFrameworkRegistry() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | for framework in Frameworks: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | self.__frameworkRegistry.register(framework) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
262 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | self.__setIdleMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
264 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | self.__loadRecent() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | self.__populateVenvComboBox() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
268 | if self.__project and self.__project.isOpen(): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
269 | self.venvComboBox.setCurrentText(self.__project.getProjectVenv()) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
270 | self.frameworkComboBox.setCurrentText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | self.__project.getProjectTestingFramework() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
273 | self.__insertDiscovery(self.__project.getProjectPath()) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | self.__insertDiscovery("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
276 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
277 | self.__insertTestFile(testfile) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
278 | self.__insertTestName("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
279 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | self.clearHistoriesButton.clicked.connect(self.clearRecent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
281 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
283 | |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
284 | def __determineInterpreter(self, venvName): |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
285 | """ |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
286 | Private method to determine the interpreter to be used. |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
287 | |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
288 | @param venvName name of the virtual environment |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
289 | @type str |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
290 | @return path of the interpreter executable |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
291 | @rtype str |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
292 | """ |
10415 | 293 | if ( |
294 | self.__project | |
295 | and venvName == ericApp().getObject("DebugUI").getProjectEnvironmentString() | |
296 | ): | |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
297 | return self.__project.getProjectInterpreter() |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
298 | else: |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
299 | return self.__venvManager.getVirtualenvInterpreter(venvName) |
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
300 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | def __populateVenvComboBox(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | Private method to (re-)populate the virtual environments selector. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | currentText = self.venvComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | if not currentText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | currentText = self.__recentEnvironment |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
308 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | self.venvComboBox.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | self.venvComboBox.addItem("") |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
311 | if self.__project and self.__project.isOpen(): |
10415 | 312 | venvName = ericApp().getObject("DebugUI").getProjectEnvironmentString() |
313 | if venvName: | |
314 | self.venvComboBox.addItem(venvName) | |
10452 | 315 | self.__projectString = venvName |
10766
d35d6f96c24b
Extended the use of eric-ide server environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10692
diff
changeset
|
316 | self.venvComboBox.addItems( |
d35d6f96c24b
Extended the use of eric-ide server environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10692
diff
changeset
|
317 | sorted(self.__venvManager.getVirtualenvNames(noServer=True)) |
d35d6f96c24b
Extended the use of eric-ide server environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10692
diff
changeset
|
318 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
319 | self.venvComboBox.setCurrentText(currentText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
320 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | def __populateTestFrameworkComboBox(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | Private method to (re-)populate the test framework selector. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | currentText = self.frameworkComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | if not currentText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | currentText = self.__recentFramework |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
328 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | self.frameworkComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
330 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | if bool(self.venvComboBox.currentText()): |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
332 | interpreter = self.__determineInterpreter(self.venvComboBox.currentText()) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | self.frameworkComboBox.addItem("") |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | for index, (name, executor) in enumerate( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
335 | sorted(self.__frameworkRegistry.getFrameworks().items()), start=1 |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | ): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | isInstalled = executor.isInstalled(interpreter) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | entry = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
339 | name if isInstalled else self.tr("{0} (not available)").format(name) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | self.frameworkComboBox.addItem(entry) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
342 | self.frameworkComboBox.model().item(index).setEnabled(isInstalled) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
343 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | self.frameworkComboBox.setCurrentText(self.__recentFramework) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
345 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
346 | def getResultsModel(self): |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
347 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
348 | Public method to get a reference to the model containing the test |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
349 | result data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
350 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
351 | @return reference to the test results model |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
352 | @rtype TestResultsModel |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
353 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
354 | return self.__resultsModel |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
355 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
356 | def hasFailedTests(self): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
357 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
358 | Public method to check for failed tests. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
360 | @return flag indicating the existence of failed tests |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
361 | @rtype bool |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
362 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
363 | return bool(self.__resultsModel.getFailedTests()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
364 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
365 | def getFailedTests(self): |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
366 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
367 | Public method to get the list of failed tests (if any). |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
369 | @return list of IDs of failed tests |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
370 | @rtype list of str |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
371 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
372 | return self.__failedTests[:] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
373 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | @pyqtSlot(str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | def __insertHistory(self, widget, history, item): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | Private slot to insert an item into a history object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
378 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | @param widget reference to the widget |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | @type QComboBox or EricComboPathPicker |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | @param history array containing the history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
382 | @type list of str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | @param item item to be inserted |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | """ |
10421 | 386 | if history and item != history[0]: |
387 | # prepend the given directory to the given widget | |
388 | if item is None: | |
389 | item = "" | |
390 | if item in history: | |
391 | history.remove(item) | |
392 | history.insert(0, item) | |
393 | widget.clear() | |
394 | widget.addItems(history) | |
395 | widget.setEditText(item) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
396 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | @pyqtSlot(str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | def __insertDiscovery(self, start): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | Private slot to insert the discovery start directory into the |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | discoveryPicker object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
402 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | @param start start directory name to be inserted |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
406 | self.__insertHistory(self.discoveryPicker, self.__discoverHistory, start) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
407 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | @pyqtSlot(str) |
9072
8d3ae97ee666
Modified the 'getTestFileName()' function of the Utilities module to allow for additional test file name patterns (currently 'test...' and 'test_...').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9070
diff
changeset
|
409 | def setTestFile(self, testFile, forProject=False): |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
410 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
411 | Public slot to set the given test file as the current one. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
412 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
413 | @param testFile path of the test file |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
414 | @type str |
9072
8d3ae97ee666
Modified the 'getTestFileName()' function of the Utilities module to allow for additional test file name patterns (currently 'test...' and 'test_...').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9070
diff
changeset
|
415 | @param forProject flag indicating that this call is for a project |
8d3ae97ee666
Modified the 'getTestFileName()' function of the Utilities module to allow for additional test file name patterns (currently 'test...' and 'test_...').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9070
diff
changeset
|
416 | (defaults to False) |
8d3ae97ee666
Modified the 'getTestFileName()' function of the Utilities module to allow for additional test file name patterns (currently 'test...' and 'test_...').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9070
diff
changeset
|
417 | @type bool (optional) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
418 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
419 | if testFile: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
420 | self.__insertTestFile(testFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
421 | |
9072
8d3ae97ee666
Modified the 'getTestFileName()' function of the Utilities module to allow for additional test file name patterns (currently 'test...' and 'test_...').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9070
diff
changeset
|
422 | self.discoverCheckBox.setChecked(forProject or not bool(testFile)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
423 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
424 | if forProject: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
425 | self.__projectOpened() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
426 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
427 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
428 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
429 | @pyqtSlot(str) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
430 | def __insertTestFile(self, prog): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | Private slot to insert a test file name into the testsuitePicker |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
434 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | @param prog test file name to be inserted |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
438 | self.__insertHistory(self.testsuitePicker, self.__fileHistory, prog) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
439 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | @pyqtSlot(str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | def __insertTestName(self, testName): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | Private slot to insert a test name into the testComboBox object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
444 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | @param testName name of the test to be inserted |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
448 | self.__insertHistory(self.testComboBox, self.__testNameHistory, testName) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
449 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | def __loadRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | Private method to load the most recently used lists. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | Preferences.Prefs.rsettings.sync() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
455 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | # 1. recently selected test framework and virtual environment |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | self.__recentEnvironment = Preferences.Prefs.rsettings.value( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
458 | recentNameTestEnvironment, "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
459 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | self.__recentFramework = Preferences.Prefs.rsettings.value( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
461 | recentNameTestFramework, "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
462 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
463 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | # 2. discovery history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | self.__discoverHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | rs = Preferences.Prefs.rsettings.value(recentNameTestDiscoverHistory) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | if rs is not None: |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10766
diff
changeset
|
468 | recent = [f for f in EricUtilities.toList(rs) if os.path.exists(f)] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
469 | self.__discoverHistory = recent[: Preferences.getDebugger("RecentNumber")] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
470 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | # 3. test file history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | self.__fileHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
473 | rs = Preferences.Prefs.rsettings.value(recentNameTestFileHistory) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | if rs is not None: |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10766
diff
changeset
|
475 | recent = [f for f in EricUtilities.toList(rs) if os.path.exists(f)] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
476 | self.__fileHistory = recent[: Preferences.getDebugger("RecentNumber")] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
477 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | # 4. test name history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | self.__testNameHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
480 | rs = Preferences.Prefs.rsettings.value(recentNameTestNameHistory) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | if rs is not None: |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10766
diff
changeset
|
482 | recent = [n for n in EricUtilities.toList(rs) if n] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
483 | self.__testNameHistory = recent[: Preferences.getDebugger("RecentNumber")] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
484 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | def __saveRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | Private method to save the most recently used lists. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
490 | recentNameTestEnvironment, self.__recentEnvironment |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
491 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
493 | recentNameTestFramework, self.__recentFramework |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
494 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
496 | recentNameTestDiscoverHistory, self.__discoverHistory |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
497 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
499 | recentNameTestFileHistory, self.__fileHistory |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
500 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
502 | recentNameTestNameHistory, self.__testNameHistory |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
503 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
504 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | Preferences.Prefs.rsettings.sync() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
506 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | @pyqtSlot() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | def clearRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | Public slot to clear the recently used lists. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | # clear histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | self.__discoverHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | self.__fileHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | self.__testNameHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
516 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | # clear widgets with histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | self.discoveryPicker.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | self.testsuitePicker.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
520 | self.testComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
521 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | # sync histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | self.__saveRecent() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
524 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
525 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
526 | def __resetResults(self): |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
527 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
528 | Private slot to reset the test results tab and data. |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
529 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
530 | self.__totalCount = 0 |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
531 | self.__runCount = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
532 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
533 | self.progressCounterRunCount.setText("0") |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
534 | self.progressCounterRemCount.setText("0") |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
535 | self.progressProgressBar.setMaximum(100) |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
536 | self.progressProgressBar.setValue(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
537 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
538 | self.statusLabel.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
539 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
540 | self.__resultsModel.clear() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
541 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
542 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
543 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | def __updateButtonBoxButtons(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
545 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
546 | Private slot to update the state of the buttons of the button box. |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
547 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
548 | failedAvailable = bool(self.__resultsModel.getFailedTests()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
549 | |
10405 | 550 | # Discover button |
551 | if self.__mode in (TestingWidgetModes.IDLE, TestingWidgetModes.STOPPED): | |
552 | self.__discoverButton.setEnabled( | |
553 | bool(self.venvComboBox.currentText()) | |
554 | and bool(self.frameworkComboBox.currentText()) | |
10413
2ecbe43a8e88
Fixed a few glitches in the testing widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10405
diff
changeset
|
555 | and self.discoverCheckBox.isChecked() |
2ecbe43a8e88
Fixed a few glitches in the testing widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10405
diff
changeset
|
556 | and bool(self.discoveryPicker.currentText()) |
10405 | 557 | ) |
558 | else: | |
559 | self.__discoverButton.setEnabled(False) | |
560 | self.__discoverButton.setDefault(False) | |
561 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
562 | # Start button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
563 | if self.__mode in (TestingWidgetModes.IDLE, TestingWidgetModes.STOPPED): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | self.__startButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
565 | bool(self.venvComboBox.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
566 | and bool(self.frameworkComboBox.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
567 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
568 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
569 | self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
570 | and bool(self.discoveryPicker.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
571 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
572 | or bool(self.testsuitePicker.currentText()) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | self.__startButton.setDefault( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
576 | self.__mode == TestingWidgetModes.IDLE or not failedAvailable |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | self.__startButton.setEnabled(False) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
580 | self.__startButton.setDefault(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
581 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
582 | # Start Failed button |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
583 | self.__startFailedButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
584 | self.__mode == TestingWidgetModes.STOPPED and failedAvailable |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
585 | ) |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
586 | self.__startFailedButton.setDefault( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
587 | self.__mode == TestingWidgetModes.STOPPED and failedAvailable |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
588 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
589 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | # Stop button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
591 | self.__stopButton.setEnabled(self.__mode == TestingWidgetModes.RUNNING) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
592 | self.__stopButton.setDefault(self.__mode == TestingWidgetModes.RUNNING) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
594 | # Code coverage button |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
595 | self.__showCoverageButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
596 | self.__mode == TestingWidgetModes.STOPPED |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
597 | and bool(self.__coverageFile) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
598 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
599 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
600 | self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
601 | and bool(self.discoveryPicker.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
602 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
603 | or bool(self.testsuitePicker.currentText()) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
604 | ) |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
605 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
606 | |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
607 | # Log output button |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
608 | self.__showLogButton.setEnabled(bool(self.__recentLog)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
609 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
610 | # Close button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
611 | self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
612 | self.__mode in (TestingWidgetModes.IDLE, TestingWidgetModes.STOPPED) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
613 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
614 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
615 | @pyqtSlot() |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
616 | def __updateProgress(self): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
617 | """ |
10020
3f2e1d0ef4e2
Optimized the testing widget code in order to speed up the display of test results (see issue 500).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
618 | Private slot to update the progress indicators. |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
619 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
620 | self.progressCounterRunCount.setText(str(self.__runCount)) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
621 | self.progressCounterRemCount.setText(str(self.__totalCount - self.__runCount)) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
622 | self.progressProgressBar.setMaximum(self.__totalCount) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
623 | self.progressProgressBar.setValue(self.__runCount) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
624 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
625 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
626 | def __setIdleMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
627 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
628 | Private slot to switch the widget to idle mode. |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
629 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
630 | self.__mode = TestingWidgetModes.IDLE |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
631 | self.__updateButtonBoxButtons() |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
632 | self.progressGroupBox.hide() |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
633 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
634 | |
10405 | 635 | self.raise_() |
636 | self.activateWindow() | |
637 | ||
638 | @pyqtSlot() | |
639 | def __setDiscoverMode(self): | |
640 | """ | |
641 | Private slot to switch the widget to test discovery mode. | |
642 | """ | |
643 | self.__mode = TestingWidgetModes.DISCOVERY | |
644 | ||
645 | self.__totalCount = 0 | |
646 | ||
647 | self.tabWidget.setCurrentIndex(0) | |
648 | self.__updateButtonBoxButtons() | |
649 | ||
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
650 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | def __setRunningMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
653 | Private slot to switch the widget to running mode. |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
655 | self.__mode = TestingWidgetModes.RUNNING |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
656 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
657 | self.__totalCount = 0 |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
658 | self.__runCount = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
659 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
660 | self.__coverageFile = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
661 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
662 | self.sbLabel.setText(self.tr("Running")) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
663 | self.tabWidget.setCurrentIndex(1) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
664 | self.__updateButtonBoxButtons() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
665 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
666 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
667 | self.progressGroupBox.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
668 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
669 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
670 | def __setStoppedMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
671 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
672 | Private slot to switch the widget to stopped mode. |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
674 | self.__mode = TestingWidgetModes.STOPPED |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
675 | if self.__totalCount == 0: |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
676 | self.progressProgressBar.setMaximum(100) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
677 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
678 | self.progressGroupBox.hide() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
679 | |
10020
3f2e1d0ef4e2
Optimized the testing widget code in order to speed up the display of test results (see issue 500).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
680 | self.__resultsTree.resizeColumns() |
3f2e1d0ef4e2
Optimized the testing widget code in order to speed up the display of test results (see issue 500).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
681 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
682 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
683 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
684 | self.testRunStopped.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
685 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
686 | self.raise_() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
687 | self.activateWindow() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
688 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
689 | @pyqtSlot(bool) |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
690 | def on_discoverCheckBox_toggled(self, _checked): |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
691 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
692 | Private slot handling state changes of the 'discover' checkbox. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
693 | |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
694 | @param _checked state of the checkbox (unused) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
695 | @type bool |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
696 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
697 | if not bool(self.discoveryPicker.currentText()): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
698 | if self.__project and self.__project.isOpen(): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
699 | self.__insertDiscovery(self.__project.getProjectPath()) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
700 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
701 | self.__insertDiscovery(Preferences.getMultiProject("Workspace")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
702 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
703 | self.__resetResults() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
704 | |
10405 | 705 | self.discoveryList.clear() |
706 | ||
707 | @pyqtSlot(str) | |
708 | def on_discoveryPicker_editTextChanged(self, txt): | |
709 | """ | |
710 | Private slot to handle a change of the discovery start directory. | |
711 | ||
712 | @param txt new discovery start directory | |
713 | @type str | |
714 | """ | |
715 | self.discoveryList.clear() | |
716 | ||
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
717 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
718 | def on_testsuitePicker_aboutToShowPathPickerDialog(self): |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
719 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
720 | Private slot called before the test file selection dialog is shown. |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
721 | """ |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
722 | if self.__project: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
723 | # we were called from within eric |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
724 | py3Extensions = " ".join( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
725 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
726 | "*{0}".format(ext) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
727 | for ext in ericApp() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
728 | .getObject("DebugServer") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
729 | .getExtensions("Python3") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
730 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
731 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
732 | fileFilter = self.tr("Python3 Files ({0});;All Files (*)").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
733 | py3Extensions |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
734 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
735 | else: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
736 | # standalone application |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
737 | fileFilter = self.tr("Python Files (*.py);;All Files (*)") |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
738 | self.testsuitePicker.setFilters(fileFilter) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
739 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
740 | defaultDirectory = ( |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
741 | self.__project.getProjectPath() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
742 | if self.__project and self.__project.isOpen() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
743 | else Preferences.getMultiProject("Workspace") |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
744 | ) |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
745 | if not defaultDirectory: |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
746 | defaultDirectory = os.path.expanduser("~") |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
747 | self.testsuitePicker.setDefaultDirectory(defaultDirectory) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
748 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
749 | @pyqtSlot(QAbstractButton) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | def on_buttonBox_clicked(self, button): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
751 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | Private slot called by a button of the button box clicked. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
753 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
754 | @param button button that was clicked |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
755 | @type QAbstractButton |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
756 | """ |
10405 | 757 | if button == self.__discoverButton: |
758 | self.__discoverTests() | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
759 | if button == self.__startButton: |
10415 | 760 | self.startTests(debug=self.debuggerCheckBox.isChecked()) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
761 | self.__saveRecent() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
762 | elif button == self.__stopButton: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
763 | self.__stopTests() |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
764 | elif button == self.__startFailedButton: |
10415 | 765 | self.startTests(failedOnly=True, debug=self.debuggerCheckBox.isChecked()) |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
766 | elif button == self.__showCoverageButton: |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
767 | self.__showCoverageDialog() |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
768 | elif button == self.__showLogButton: |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
769 | self.__showLogOutput() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
770 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
771 | @pyqtSlot(int) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
772 | def on_venvComboBox_currentIndexChanged(self, index): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
773 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
774 | Private slot handling the selection of a virtual environment. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
775 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
776 | @param index index of the selected environment |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
777 | @type int |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
778 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | self.__populateTestFrameworkComboBox() |
10413
2ecbe43a8e88
Fixed a few glitches in the testing widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10405
diff
changeset
|
780 | self.discoveryList.clear() |
2ecbe43a8e88
Fixed a few glitches in the testing widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10405
diff
changeset
|
781 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
782 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
783 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | self.versionsButton.setEnabled(bool(self.venvComboBox.currentText())) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
785 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
786 | self.__updateCoverage() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
787 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
788 | @pyqtSlot(int) |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
789 | def on_frameworkComboBox_currentIndexChanged(self, index): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
790 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
791 | Private slot handling the selection of a test framework. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
792 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
793 | @param index index of the selected framework |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
794 | @type int |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
795 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
796 | self.__resetResults() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
797 | self.__updateCoverage() |
9311 | 798 | self.__updateMarkerSupport() |
9313 | 799 | self.__updatePatternSupport() |
10413
2ecbe43a8e88
Fixed a few glitches in the testing widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10405
diff
changeset
|
800 | self.discoveryList.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
801 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
802 | @pyqtSlot() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
803 | def __updateCoverage(self): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
804 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
805 | Private slot to update the state of the coverage checkbox depending on |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
806 | the selected framework's capabilities. |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
807 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
808 | hasCoverage = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
810 | venvName = self.venvComboBox.currentText() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
811 | if venvName: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
812 | framework = self.frameworkComboBox.currentText() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
813 | if framework: |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
814 | interpreter = self.__determineInterpreter(venvName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
815 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
816 | hasCoverage = executor.hasCoverage(interpreter) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
817 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
818 | self.coverageCheckBox.setEnabled(hasCoverage) |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
819 | if not hasCoverage: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
820 | self.coverageCheckBox.setChecked(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
821 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | @pyqtSlot() |
9311 | 823 | def __updateMarkerSupport(self): |
824 | """ | |
825 | Private slot to update the state of the marker related widgets depending on | |
826 | the selected framework's capabilities. | |
827 | """ | |
828 | supportsMarkers = False | |
829 | ||
830 | venvName = self.venvComboBox.currentText() | |
831 | if venvName: | |
832 | framework = self.frameworkComboBox.currentText() | |
833 | if framework: | |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
834 | interpreter = self.__determineInterpreter(venvName) |
9311 | 835 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
836 | supportsMarkers = executor.supportsMarkers(interpreter) | |
837 | ||
838 | # 1. marker expression line edit | |
839 | self.markerExpressionEdit.setEnabled(supportsMarkers) | |
840 | if not supportsMarkers: | |
841 | self.markerExpressionEdit.clear() | |
842 | ||
843 | # 2. show markers button | |
844 | self.showMarkersButton.setEnabled(supportsMarkers) | |
845 | if self.__markersWindow is not None: | |
846 | self.__markersWindow.close() | |
847 | ||
848 | @pyqtSlot() | |
849 | def on_showMarkersButton_clicked(self): | |
850 | """ | |
851 | Private slot to show a window containing the list of defined markers. | |
852 | """ | |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
853 | from .MarkersWindow import MarkersWindow |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
854 | |
9311 | 855 | venvName = self.venvComboBox.currentText() |
856 | if venvName: | |
857 | framework = self.frameworkComboBox.currentText() | |
858 | if framework: | |
859 | if self.discoverCheckBox.isChecked(): | |
860 | workdir = self.discoveryPicker.currentText() | |
861 | elif self.testsuitePicker.currentText(): | |
862 | workdir = os.path.dirname(self.testsuitePicker.currentText()) | |
863 | else: | |
864 | workdir = "" | |
865 | ||
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
866 | interpreter = self.__determineInterpreter(venvName) |
9311 | 867 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
868 | markers = executor.getMarkers(interpreter, workdir) | |
869 | ||
870 | if self.__markersWindow is None: | |
871 | self.__markersWindow = MarkersWindow() | |
872 | self.__markersWindow.showMarkers(markers) | |
873 | ||
874 | @pyqtSlot() | |
9313 | 875 | def __updatePatternSupport(self): |
876 | """ | |
877 | Private slot to update the state of the test name pattern line edit depending on | |
878 | the selected framework's capabilities. | |
879 | """ | |
880 | supportsPatterns = False | |
881 | ||
882 | venvName = self.venvComboBox.currentText() | |
883 | if venvName: | |
884 | framework = self.frameworkComboBox.currentText() | |
885 | if framework: | |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
886 | interpreter = self.__determineInterpreter(venvName) |
9313 | 887 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
888 | supportsPatterns = executor.supportsPatterns(interpreter) | |
889 | ||
890 | self.testNamePatternEdit.setEnabled(supportsPatterns) | |
891 | self.testNamePatternEdit.clear() | |
892 | ||
893 | @pyqtSlot() | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
894 | def on_versionsButton_clicked(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
895 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | Private slot to show the versions of available plugins. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
897 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | venvName = self.venvComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
899 | if venvName: |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
900 | headerText = self.tr("<h3>Versions of Frameworks and their Plugins</h3>") |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
901 | versionsText = "" |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
902 | interpreter = self.__determineInterpreter(venvName) |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10303
diff
changeset
|
903 | for framework in sorted(self.__frameworkRegistry.getFrameworks()): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
904 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
905 | versions = executor.getVersions(interpreter) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
906 | if versions: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
907 | txt = "<p><strong>{0} {1}</strong>".format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
908 | versions["name"], versions["version"] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
909 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
910 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
911 | if versions["plugins"]: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | txt += "<table>" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | for pluginVersion in versions["plugins"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
914 | txt += self.tr("<tr><td>{0}</td><td>{1}</td></tr>").format( |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
915 | pluginVersion["name"], pluginVersion["version"] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | txt += "</table>" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
918 | txt += "</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
919 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
920 | versionsText += txt |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
921 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
922 | if not versionsText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
923 | versionsText = self.tr("No version information available.") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
924 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | EricMessageBox.information( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
926 | self, self.tr("Versions"), headerText + versionsText |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
928 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
929 | @pyqtSlot() |
10405 | 930 | def __discoverTests(self): |
931 | """ | |
932 | Private slot to discover tests but don't execute them. | |
933 | """ | |
934 | if self.__mode in (TestingWidgetModes.RUNNING, TestingWidgetModes.DISCOVERY): | |
935 | return | |
936 | ||
937 | self.__recentLog = "" | |
938 | ||
939 | environment = self.venvComboBox.currentText() | |
940 | framework = self.frameworkComboBox.currentText() | |
941 | ||
942 | discoveryStart = self.discoveryPicker.currentText() | |
10421 | 943 | if discoveryStart: |
944 | self.__insertDiscovery(discoveryStart) | |
10405 | 945 | |
946 | self.sbLabel.setText(self.tr("Discovering Tests")) | |
947 | QCoreApplication.processEvents() | |
948 | ||
949 | interpreter = self.__determineInterpreter(environment) | |
950 | config = TestConfig( | |
951 | interpreter=interpreter, | |
952 | discover=True, | |
953 | discoveryStart=discoveryStart, | |
954 | discoverOnly=True, | |
955 | testNamePattern=self.testNamePatternEdit.text(), | |
956 | testMarkerExpression=self.markerExpressionEdit.text(), | |
957 | failFast=self.failfastCheckBox.isChecked(), | |
958 | ) | |
959 | ||
960 | self.__testExecutor = self.__frameworkRegistry.createExecutor(framework, self) | |
961 | self.__testExecutor.collected.connect(self.__testsDiscovered) | |
962 | self.__testExecutor.collectError.connect(self.__testDiscoveryError) | |
963 | self.__testExecutor.testFinished.connect(self.__testDiscoveryProcessFinished) | |
964 | self.__testExecutor.discoveryAboutToBeStarted.connect( | |
965 | self.__testDiscoveryAboutToBeStarted | |
966 | ) | |
967 | ||
968 | self.__setDiscoverMode() | |
969 | self.__testExecutor.discover(config, []) | |
970 | ||
971 | @pyqtSlot() | |
10415 | 972 | def startTests(self, failedOnly=False, debug=False): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
973 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
974 | Public slot to start the test run. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
975 | |
10415 | 976 | @param failedOnly flag indicating to run only failed tests (defaults to False) |
977 | @type bool (optional) | |
978 | @param debug flag indicating to start the test run with debugger support | |
979 | (defaults to False) | |
980 | @type bool (optional) | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
981 | """ |
10405 | 982 | if self.__mode in (TestingWidgetModes.RUNNING, TestingWidgetModes.DISCOVERY): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
984 | |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
985 | self.__recentLog = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
986 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | self.__recentEnvironment = self.venvComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
988 | self.__recentFramework = self.frameworkComboBox.currentText() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
989 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
990 | self.__failedTests = self.__resultsModel.getFailedTests() if failedOnly else [] |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
991 | discover = self.discoverCheckBox.isChecked() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
992 | if discover: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
993 | discoveryStart = self.discoveryPicker.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
994 | testFileName = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | testName = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
996 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
997 | if discoveryStart: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
998 | self.__insertDiscovery(discoveryStart) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
999 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1000 | discoveryStart = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1001 | testFileName = self.testsuitePicker.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | if testFileName: |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1003 | self.__insertTestFile(testFileName) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1004 | testName = self.testComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1005 | if testName: |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1006 | self.__insertTestName(testName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1007 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1008 | self.sbLabel.setText(self.tr("Preparing Testsuite")) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1009 | QCoreApplication.processEvents() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1011 | if self.__project: |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1012 | mainScript = self.__project.getMainScript(True) |
9084
ee36935f4edd
Corrected some little issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9081
diff
changeset
|
1013 | coverageFile = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1014 | os.path.splitext(mainScript)[0] + ".coverage" if mainScript else "" |
9084
ee36935f4edd
Corrected some little issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9081
diff
changeset
|
1015 | ) |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1016 | else: |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1017 | coverageFile = "" |
9388
bfe7ea6599a3
Added support for project embedded environments to the Testing framework and the Start dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9313
diff
changeset
|
1018 | interpreter = self.__determineInterpreter(self.__recentEnvironment) |
10415 | 1019 | |
10405 | 1020 | testCases = self.__selectedTestCases() |
1021 | if not testCases and self.discoveryList.topLevelItemCount() > 0: | |
1022 | ok = EricMessageBox.yesNo( | |
1023 | self, | |
1024 | self.tr("Running Tests"), | |
1025 | self.tr("No test case has been selected. Shall all test cases be run?"), | |
1026 | ) | |
1027 | if not ok: | |
1028 | return | |
1029 | ||
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1030 | config = TestConfig( |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1031 | interpreter=interpreter, |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1032 | discover=discover, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1033 | discoveryStart=discoveryStart, |
10405 | 1034 | testCases=testCases, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1035 | testFilename=testFileName, |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1036 | testName=testName, |
9313 | 1037 | testNamePattern=self.testNamePatternEdit.text(), |
9311 | 1038 | testMarkerExpression=self.markerExpressionEdit.text(), |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | failFast=self.failfastCheckBox.isChecked(), |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1040 | failedOnly=failedOnly, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1041 | collectCoverage=self.coverageCheckBox.isChecked(), |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | eraseCoverage=self.coverageEraseCheckBox.isChecked(), |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1043 | coverageFile=coverageFile, |
10415 | 1044 | venvName=self.__recentEnvironment, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1045 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1046 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1047 | self.__testExecutor = self.__frameworkRegistry.createExecutor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1048 | self.__recentFramework, self |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1049 | ) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1050 | self.__testExecutor.collected.connect(self.__testsCollected) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1051 | self.__testExecutor.collectError.connect(self.__testsCollectError) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1052 | self.__testExecutor.startTest.connect(self.__testStarted) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1053 | self.__testExecutor.testResult.connect(self.__processTestResult) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1054 | self.__testExecutor.testFinished.connect(self.__testProcessFinished) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1055 | self.__testExecutor.testRunFinished.connect(self.__testRunFinished) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1056 | self.__testExecutor.stop.connect(self.__testsStopped) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1057 | self.__testExecutor.coverageDataSaved.connect(self.__coverageData) |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1058 | self.__testExecutor.testRunAboutToBeStarted.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1059 | self.__testRunAboutToBeStarted |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1060 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1061 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1062 | self.__setRunningMode() |
10415 | 1063 | if debug: |
1064 | self.__testExecutor.startDebug(config, [], ericApp().getObject("DebugUI")) | |
1065 | else: | |
1066 | self.__testExecutor.start(config, []) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1067 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1068 | @pyqtSlot() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1069 | def __stopTests(self): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1070 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1071 | Private slot to stop the current test run. |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1072 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1073 | self.__testExecutor.stopIfRunning() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1074 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1075 | @pyqtSlot(list) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1076 | def __testsCollected(self, testNames): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1077 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1078 | Private slot handling the 'collected' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1079 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1080 | @param testNames list of tuples containing the test id, the test name |
10405 | 1081 | a description, the file name, the line number and the test path as a list |
1082 | of collected tests | |
1083 | @type list of tuple of (str, str, str, str, int, list) | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1084 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1085 | testResults = [ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1086 | TestResult( |
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1087 | category=TestResultCategory.PENDING, |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1088 | status=self.tr("pending"), |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1089 | name=name, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1090 | id=id, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1091 | message=desc, |
10404 | 1092 | filename=filename, |
1093 | lineno=lineno, | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1094 | ) |
10405 | 1095 | for id, name, desc, filename, lineno, _ in testNames |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1096 | ] |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1097 | self.__resultsModel.addTestResults(testResults) |
10020
3f2e1d0ef4e2
Optimized the testing widget code in order to speed up the display of test results (see issue 500).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
1098 | self.__resultsTree.resizeColumns() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1099 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1100 | self.__totalCount += len(testResults) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1101 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1102 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1103 | @pyqtSlot(list) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1104 | def __testsCollectError(self, errors): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1105 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1106 | Private slot handling the 'collectError' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1107 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1108 | @param errors list of tuples containing the test name and a description |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1109 | of the error |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1110 | @type list of tuple of (str, str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1111 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1112 | testResults = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1113 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1114 | for testFile, error in errors: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1115 | if testFile: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1116 | testResults.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1117 | TestResult( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1118 | category=TestResultCategory.FAIL, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1119 | status=self.tr("Failure"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1120 | name=testFile, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1121 | id=testFile, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1122 | message=self.tr("Collection Error"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1123 | extra=error.splitlines(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1124 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1125 | ) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1126 | else: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1127 | EricMessageBox.critical( |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1128 | self, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1129 | self.tr("Collection Error"), |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1130 | self.tr( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
1131 | "<p>There was an error while collecting tests.</p><p>{0}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1132 | ).format("<br/>".join(error.splitlines())), |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1133 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1134 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1135 | if testResults: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1136 | self.__resultsModel.addTestResults(testResults) |
10020
3f2e1d0ef4e2
Optimized the testing widget code in order to speed up the display of test results (see issue 500).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
1137 | self.__resultsTree.resizeColumns() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1138 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1139 | @pyqtSlot(tuple) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1140 | def __testStarted(self, test): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1141 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1142 | Private slot handling the 'startTest' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1143 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1144 | @param test tuple containing the id, name and short description of the |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1145 | tests about to be run |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1146 | @type tuple of (str, str, str) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1147 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1148 | self.__resultsModel.updateTestResults( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1149 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1150 | TestResult( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1151 | category=TestResultCategory.RUNNING, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1152 | status=self.tr("running"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1153 | id=test[0], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1154 | name=test[1], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1155 | message="" if test[2] is None else test[2], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1156 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1157 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1158 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1159 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1160 | @pyqtSlot(TestResult) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1161 | def __processTestResult(self, result): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1162 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1163 | Private slot to handle the receipt of a test result object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1164 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1165 | @param result test result object |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1166 | @type TestResult |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1167 | """ |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1168 | if not result.subtestResult: |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1169 | self.__runCount += 1 |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1170 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1171 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1172 | self.__resultsModel.updateTestResults([result]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1173 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1174 | @pyqtSlot(list, str) |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1175 | def __testProcessFinished(self, _results, output): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1176 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | Private slot to handle the 'testFinished' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1178 | |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1179 | @param _results list of test result objects (if not sent via the |
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1180 | 'testResult' signal) (unused) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1181 | @type list of TestResult |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1182 | @param output string containing the test process output (if any) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1183 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | """ |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1185 | self.__recentLog = output |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1186 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1187 | self.__setStoppedMode() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1188 | self.__testExecutor = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1189 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1190 | self.__adjustPendingState() |
10404 | 1191 | self.__updateStatusFilterComboBox() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1192 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1193 | @pyqtSlot(int, float) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1194 | def __testRunFinished(self, noTests, duration): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1195 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1196 | Private slot to handle the 'testRunFinished' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1197 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1198 | @param noTests number of tests run by the executor |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1199 | @type int |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1200 | @param duration time needed in seconds to run the tests |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1201 | @type float |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1202 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1203 | self.sbLabel.setText( |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1204 | self.tr("Ran %n test(s) in {0}s", "", noTests).format( |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1205 | locale.format_string("%.3f", duration, grouping=True) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1206 | ) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1207 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1208 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1209 | self.__setStoppedMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1210 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | @pyqtSlot() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1212 | def __testsStopped(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1213 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1214 | Private slot to handle the 'stop' signal of the executor. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1215 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1216 | self.sbLabel.setText(self.tr("Ran %n test(s)", "", self.__runCount)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1217 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1218 | self.__setStoppedMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1219 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1220 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1221 | def __testRunAboutToBeStarted(self): |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1222 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1223 | Private slot to handle the 'testRunAboutToBeStarted' signal of the |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1224 | executor. |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1225 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1226 | self.__resultsModel.clear() |
10404 | 1227 | self.statusFilterComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1228 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1229 | def __adjustPendingState(self): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1230 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1231 | Private method to change the status indicator of all still pending |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1232 | tests to "not run". |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1233 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1234 | newResults = [] |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1235 | for result in self.__resultsModel.getTestResults(): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1236 | if result.category == TestResultCategory.PENDING: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1237 | result.category = TestResultCategory.SKIP |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1238 | result.status = self.tr("not run") |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1239 | newResults.append(result) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1240 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1241 | if newResults: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1242 | self.__resultsModel.updateTestResults(newResults) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1243 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1244 | @pyqtSlot(str) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1245 | def __coverageData(self, coverageFile): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1246 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1247 | Private slot to handle the 'coverageData' signal of the executor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1248 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1249 | @param coverageFile file containing the coverage data |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1250 | @type str |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1251 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1252 | self.__coverageFile = coverageFile |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1253 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1254 | @pyqtSlot() |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1255 | def __showCoverageDialog(self): |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1256 | """ |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1257 | Private slot to show a code coverage dialog for the most recent test |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1258 | run. |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1259 | """ |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1260 | if self.__coverageDialog is None: |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1261 | self.__coverageDialog = PyCoverageDialog(self) |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1262 | self.__coverageDialog.openFile.connect(self.__openEditor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1263 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1264 | testDir = ( |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1265 | self.discoveryPicker.currentText() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1266 | if self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1267 | else os.path.dirname(self.testsuitePicker.currentText()) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1268 | ) |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1269 | if testDir: |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1270 | self.__coverageDialog.show() |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1271 | self.__coverageDialog.start(self.__coverageFile, testDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1272 | |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1273 | @pyqtSlot() |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1274 | def __showLogOutput(self): |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1275 | """ |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1276 | Private slot to show the output of the most recent test run. |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1277 | """ |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
1278 | from eric7.EricWidgets.EricPlainTextDialog import EricPlainTextDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1279 | |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1280 | dlg = EricPlainTextDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10933
diff
changeset
|
1281 | title=self.tr("Test Run Output"), text=self.__recentLog, parent=self |
9093
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1282 | ) |
437bfe0c5793
Implemented the functionality to show the output of the last test run (i.e. the output sent by the test runner).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9089
diff
changeset
|
1283 | dlg.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1284 | |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1285 | @pyqtSlot(str) |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1286 | def __setStatusLabel(self, statusText): |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1287 | """ |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1288 | Private slot to set the status label to the text sent by the model. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1289 | |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1290 | @param statusText text to be shown |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1291 | @type str |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1292 | """ |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1293 | self.statusLabel.setText(f"<b>{statusText}</b>") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1294 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1295 | @pyqtSlot() |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1296 | def __projectOpened(self): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1297 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1298 | Private slot to handle a project being opened. |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1299 | """ |
10452 | 1300 | self.__projectString = ( |
1301 | ericApp().getObject("DebugUI").getProjectEnvironmentString() | |
10415 | 1302 | ) |
10452 | 1303 | |
1304 | if self.__projectString: | |
1305 | # 1a. remove old project venv entries | |
1306 | while (row := self.venvComboBox.findText(self.__projectString)) != -1: | |
1307 | self.venvComboBox.removeItem(row) | |
1308 | ||
1309 | # 1b. add a new project venv entry | |
1310 | self.venvComboBox.insertItem(1, self.__projectString) | |
1311 | self.venvComboBox.setCurrentIndex(1) | |
1312 | ||
1313 | # 2. set some other project related stuff | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1314 | self.frameworkComboBox.setCurrentText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1315 | self.__project.getProjectTestingFramework() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1316 | ) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1317 | self.__insertDiscovery(self.__project.getProjectPath()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1318 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1319 | @pyqtSlot() |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1320 | def __projectClosed(self): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1321 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1322 | Private slot to handle a project being closed. |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1323 | """ |
10452 | 1324 | if self.__projectString: |
1325 | while (row := self.venvComboBox.findText(self.__projectString)) != -1: | |
1326 | self.venvComboBox.removeItem(row) | |
1327 | ||
1328 | self.venvComboBox.setCurrentText("") | |
1329 | ||
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1330 | self.frameworkComboBox.setCurrentText("") |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1331 | self.__insertDiscovery("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1332 | |
10453 | 1333 | # clear latest log assuming it was for a project test run |
1334 | self.__recentLog = "" | |
1335 | ||
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1336 | @pyqtSlot(str, int) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1337 | def __showSource(self, filename, lineno): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1338 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1339 | Private slot to show the source of a traceback in an editor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1340 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1341 | @param filename file name of the file to be shown |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1342 | @type str |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1343 | @param lineno line number to go to in the file |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1344 | @type int |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1345 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1346 | if self.__project: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1347 | # running as part of eric IDE |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1348 | self.testFile.emit(filename, lineno, True) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1349 | else: |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1350 | self.__openEditor(filename, lineno) |
10405 | 1351 | self.__resultsTree.resizeColumns() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1352 | |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1353 | def __openEditor(self, filename, linenumber=1): |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1354 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1355 | Private method to open an editor window for the given file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1356 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1357 | Note: This method opens an editor window when the testing dialog |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1358 | is called as a standalone application. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1359 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1360 | @param filename path of the file to be opened |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1361 | @type str |
9070
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1362 | @param linenumber line number to place the cursor at (defaults to 1) |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1363 | @type int (optional) |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1364 | """ |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9388
diff
changeset
|
1365 | from eric7.QScintilla.MiniEditor import MiniEditor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1366 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1367 | editor = MiniEditor(filename, "Python3", self) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1368 | editor.gotoLine(linenumber) |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1369 | editor.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1370 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1371 | self.__editors.append(editor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1372 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1373 | def closeEvent(self, event): |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1374 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1375 | Protected method to handle the close event. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1376 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1377 | @param event close event |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1378 | @type QCloseEvent |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1379 | """ |
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1380 | event.accept() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1381 | |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1382 | for editor in self.__editors: |
9462
e65379fdbd97
Changed code to resolve or acknowledge some potential security issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1383 | with contextlib.suppress(RuntimeError): |
9065
39405e6eba20
Integrated the new testing widget into the eric IDE (compared to as a standalone app) and implemented the 'Show Source' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9064
diff
changeset
|
1384 | editor.close() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1385 | |
10404 | 1386 | @pyqtSlot(str) |
1387 | def on_statusFilterComboBox_currentTextChanged(self, status): | |
1388 | """ | |
1389 | Private slot handling the selection of a status for items to be shown. | |
1390 | ||
1391 | @param status selected status | |
1392 | @type str | |
1393 | """ | |
1394 | if status == self.__allFilter: | |
1395 | status = "" | |
1396 | ||
1397 | self.__resultFilterModel.setStatusFilterString(status) | |
1398 | ||
10405 | 1399 | if not self.__project: |
1400 | # running in standalone mode | |
1401 | self.__resultsTree.resizeColumns() | |
1402 | ||
10404 | 1403 | def __updateStatusFilterComboBox(self): |
10405 | 1404 | """ |
1405 | Private method to update the status filter dialog box. | |
1406 | """ | |
10404 | 1407 | statusFilters = self.__resultsModel.getStatusFilterList() |
1408 | self.statusFilterComboBox.clear() | |
1409 | self.statusFilterComboBox.addItem(self.__allFilter) | |
1410 | self.statusFilterComboBox.addItems(sorted(statusFilters)) | |
1411 | ||
10405 | 1412 | ############################################################################ |
1413 | ## Methods below are handling the discovery only mode. | |
1414 | ############################################################################ | |
1415 | ||
1416 | def __findDiscoveryItem(self, modulePath): | |
1417 | """ | |
1418 | Private method to find an item given the module path. | |
1419 | ||
1420 | @param modulePath path of the module in dotted notation | |
1421 | @type str | |
1422 | @return reference to the item or None | |
1423 | @rtype QTreeWidgetItem or None | |
1424 | """ | |
1425 | itm = self.discoveryList.topLevelItem(0) | |
1426 | while itm is not None: | |
1427 | if itm.data(0, TestingWidget.TestCaseNameRole) == modulePath: | |
1428 | return itm | |
1429 | ||
1430 | itm = self.discoveryList.itemBelow(itm) | |
1431 | ||
1432 | return None | |
1433 | ||
1434 | @pyqtSlot(list) | |
1435 | def __testsDiscovered(self, testNames): | |
1436 | """ | |
1437 | Private slot handling the 'collected' signal of the executor in discovery | |
1438 | mode. | |
1439 | ||
1440 | @param testNames list of tuples containing the test id, the test name | |
1441 | a description, the file name, the line number and the test path as a list | |
1442 | of collected tests | |
1443 | @type list of tuple of (str, str, str, str, int, list) | |
1444 | """ | |
1445 | for tid, _name, _desc, filename, lineno, testPath in testNames: | |
1446 | parent = None | |
1447 | for index in range(1, len(testPath) + 1): | |
1448 | modulePath = ".".join(testPath[:index]) | |
1449 | itm = self.__findDiscoveryItem(modulePath) | |
1450 | if itm is not None: | |
1451 | parent = itm | |
1452 | else: | |
1453 | if parent is None: | |
1454 | itm = QTreeWidgetItem(self.discoveryList, [testPath[index - 1]]) | |
1455 | else: | |
1456 | itm = QTreeWidgetItem(parent, [testPath[index - 1]]) | |
1457 | parent.setExpanded(True) | |
1458 | itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) | |
1459 | itm.setCheckState(0, Qt.CheckState.Unchecked) | |
1460 | itm.setData(0, TestingWidget.TestCaseNameRole, modulePath) | |
1461 | itm.setData(0, TestingWidget.TestCaseLinenoRole, 0) | |
1462 | if os.path.splitext(os.path.basename(filename))[0] == itm.text(0): | |
1463 | itm.setData(0, TestingWidget.TestCaseFileRole, filename) | |
1464 | elif parent: | |
1465 | fn = parent.data(0, TestingWidget.TestCaseFileRole) | |
1466 | if fn: | |
1467 | itm.setData(0, TestingWidget.TestCaseFileRole, fn) | |
1468 | parent = itm | |
1469 | ||
1470 | if parent: | |
1471 | parent.setData(0, TestingWidget.TestCaseLinenoRole, lineno) | |
1472 | parent.setData(0, TestingWidget.TestCaseIdRole, tid) | |
1473 | ||
1474 | self.__totalCount += len(testNames) | |
1475 | ||
1476 | self.sbLabel.setText(self.tr("Discovered %n Test(s)", "", self.__totalCount)) | |
1477 | ||
1478 | def __testDiscoveryError(self, errors): | |
1479 | """ | |
1480 | Private slot handling the 'collectError' signal of the executor. | |
1481 | ||
1482 | @param errors list of tuples containing the test name and a description | |
1483 | of the error | |
1484 | @type list of tuple of (str, str) | |
1485 | """ | |
1486 | for _testFile, error in errors: | |
1487 | EricMessageBox.critical( | |
1488 | self, | |
1489 | self.tr("Discovery Error"), | |
1490 | self.tr( | |
1491 | "<p>There was an error while discovering tests in <b>{0}</b>.</p>" | |
1492 | "<p>{1}</p>" | |
10451 | 1493 | ).format( |
1494 | self.discoveryPicker.currentText(), | |
1495 | "<br/>".join(error.splitlines()), | |
1496 | ), | |
10405 | 1497 | ) |
10453 | 1498 | self.sbLabel.clear() |
10405 | 1499 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10453
diff
changeset
|
1500 | def __testDiscoveryProcessFinished(self, _results, output): |
10405 | 1501 | """ |
1502 | Private slot to handle the 'testFinished' signal of the executor in | |
1503 | discovery mode. | |
1504 | ||
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10453
diff
changeset
|
1505 | @param _results list of test result objects (if not sent via the |
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10453
diff
changeset
|
1506 | 'testResult' signal) (unused) |
10405 | 1507 | @type list of TestResult |
1508 | @param output string containing the test process output (if any) | |
1509 | @type str | |
1510 | """ | |
1511 | self.__recentLog = output | |
10424
1a64ad8acf9d
Added code to sort the list of discovered test cases in ascending order after the discovery run .
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10421
diff
changeset
|
1512 | self.discoveryList.sortItems(0, Qt.SortOrder.AscendingOrder) |
10405 | 1513 | |
1514 | self.__setIdleMode() | |
1515 | ||
1516 | def __testDiscoveryAboutToBeStarted(self): | |
1517 | """ | |
1518 | Private slot to handle the 'testDiscoveryAboutToBeStarted' signal of the | |
1519 | executor. | |
1520 | """ | |
1521 | self.discoveryList.clear() | |
1522 | ||
1523 | @pyqtSlot(QTreeWidgetItem, int) | |
1524 | def on_discoveryList_itemChanged(self, item, column): | |
1525 | """ | |
1526 | Private slot handling the user checking or unchecking an item. | |
1527 | ||
1528 | @param item reference to the item | |
1529 | @type QTreeWidgetItem | |
1530 | @param column changed column | |
1531 | @type int | |
1532 | """ | |
1533 | if column == 0: | |
1534 | for index in range(item.childCount()): | |
1535 | item.child(index).setCheckState(0, item.checkState(0)) | |
1536 | ||
1537 | @pyqtSlot(QTreeWidgetItem, int) | |
1538 | def on_discoveryList_itemActivated(self, item, column): | |
1539 | """ | |
1540 | Private slot handling the user activating an item. | |
1541 | ||
1542 | @param item reference to the item | |
1543 | @type QTreeWidgetItem | |
1544 | @param column column of the double click | |
1545 | @type int | |
1546 | """ | |
1547 | if item: | |
1548 | filename = item.data(0, TestingWidget.TestCaseFileRole) | |
1549 | if filename: | |
1550 | self.__showSource( | |
1551 | filename, item.data(0, TestingWidget.TestCaseLinenoRole) + 1 | |
1552 | ) | |
1553 | ||
1554 | def __selectedTestCases(self, parent=None): | |
1555 | """ | |
1556 | Private method to assemble the list of selected test cases and suites. | |
1557 | ||
1558 | @param parent reference to the parent item | |
1559 | @type QTreeWidgetItem | |
1560 | @return list of selected test cases | |
1561 | @rtype list of str | |
1562 | """ | |
1563 | selectedTests = [] | |
1564 | itemsList = ( | |
1565 | [ | |
1566 | # top level | |
1567 | self.discoveryList.topLevelItem(index) | |
1568 | for index in range(self.discoveryList.topLevelItemCount()) | |
1569 | ] | |
1570 | if parent is None | |
1571 | else [parent.child(index) for index in range(parent.childCount())] | |
1572 | ) | |
1573 | ||
1574 | for itm in itemsList: | |
1575 | if itm.checkState(0) == Qt.CheckState.Checked and itm.childCount() == 0: | |
1576 | selectedTests.append(itm.data(0, TestingWidget.TestCaseIdRole)) | |
1577 | if itm.childCount(): | |
1578 | # recursively check children | |
1579 | selectedTests.extend(self.__selectedTestCases(itm)) | |
1580 | ||
1581 | return selectedTests | |
1582 | ||
10442 | 1583 | @pyqtSlot(QPoint) |
1584 | def on_discoveryList_customContextMenuRequested(self, pos): | |
1585 | """ | |
1586 | Private slot to show the context menu of the dicovery list. | |
1587 | ||
1588 | @param pos the position of the mouse pointer | |
1589 | @type QPoint | |
1590 | """ | |
1591 | self.__discoveryListContextMenu.exec(self.discoveryList.mapToGlobal(pos)) | |
1592 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1593 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1594 | class TestingWindow(EricMainWindow): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1595 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1596 | Main window class for the standalone dialog. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1597 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1598 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1599 | def __init__(self, testfile=None, parent=None): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1600 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1601 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1602 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1603 | @param testfile file name of the test script to open |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1604 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1605 | @param parent reference to the parent widget |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1606 | @type QWidget |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1607 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1608 | super().__init__(parent) |
10303
ee1aadab1215
Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10217
diff
changeset
|
1609 | self.__cw = TestingWidget(parent=self) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1610 | self.__cw.installEventFilter(self) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1611 | size = self.__cw.size() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1612 | self.setCentralWidget(self.__cw) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1613 | self.resize(size) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1614 | |
10933
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
1615 | self.setStyle( |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
1616 | styleName=Preferences.getUI("Style"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
1617 | styleSheetFile=Preferences.getUI("StyleSheet"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
1618 | itemClickBehavior=Preferences.getUI("ActivateItemOnSingleClick"), |
95a15b70f7bb
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10806
diff
changeset
|
1619 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1620 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1621 | self.__cw.buttonBox.accepted.connect(self.close) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1622 | self.__cw.buttonBox.rejected.connect(self.close) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1623 | |
10303
ee1aadab1215
Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10217
diff
changeset
|
1624 | self.__cw.setTestFile(testfile) |
ee1aadab1215
Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10217
diff
changeset
|
1625 | |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1626 | def eventFilter(self, _obj, event): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1627 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1628 | Public method to filter events. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1629 | |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1630 | @param _obj reference to the object the event is meant for (unused) |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10424
diff
changeset
|
1631 | @type QObject |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10424
diff
changeset
|
1632 | @param event reference to the event object |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10424
diff
changeset
|
1633 | @type QEvent |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10424
diff
changeset
|
1634 | @return flag indicating, whether the event was handled |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10424
diff
changeset
|
1635 | @rtype bool |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1636 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1637 | if event.type() == QEvent.Type.Close: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1638 | QCoreApplication.exit(0) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1639 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1640 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1641 | return False |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1642 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1643 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1644 | def clearSavedHistories(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1645 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1646 | Function to clear the saved history lists. |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1647 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1648 | Preferences.Prefs.rsettings.setValue(recentNameTestDiscoverHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1649 | Preferences.Prefs.rsettings.setValue(recentNameTestFileHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1650 | Preferences.Prefs.rsettings.setValue(recentNameTestNameHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1651 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1652 | Preferences.Prefs.rsettings.sync() |