Mon, 05 Sep 2022 18:08:43 +0200
Testing
- extended the testing dialog to allow test case filtering on markers (pytest only)
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 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
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 | |
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
|
15 | from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent, QCoreApplication |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
16 | from PyQt6.QtWidgets import QAbstractButton, QComboBox, QDialogButtonBox, QWidget |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from EricWidgets import EricMessageBox |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | from EricWidgets.EricApplication import ericApp |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | from EricWidgets.EricMainWindow import EricMainWindow |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | from EricWidgets.EricPathPicker import EricPathPickerModes |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
23 | 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
|
24 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
25 | from .TestResultsTree import TestResultsModel, TestResultsTreeView |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | from .Interfaces import Frameworks |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
27 | 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
|
28 | from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | import Preferences |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | import UI.PixmapCache |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | from Globals import ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
34 | recentNameTestDiscoverHistory, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
35 | recentNameTestFileHistory, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
36 | recentNameTestNameHistory, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | recentNameTestFramework, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
38 | recentNameTestEnvironment, |
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 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
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 | 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
|
43 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
44 | 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
|
45 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
46 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
47 | 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
|
48 | 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
|
49 | STOPPED = 2 # test run finished |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
52 | 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
|
53 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | 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
|
55 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
56 | @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
|
57 | 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
|
58 | @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
|
59 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
61 | 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
|
62 | testRunStopped = pyqtSignal() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | 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
|
65 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
67 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | @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
|
69 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | @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
|
71 | @type QWidget (optional) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | super().__init__(parent) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.__resultsModel = TestResultsModel(self) |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
77 | self.__resultsModel.summary.connect(self.__setStatusLabel) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | self.__resultsTree = TestResultsTreeView(self) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.__resultsTree.setModel(self.__resultsModel) |
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
|
80 | 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
|
81 | 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
|
82 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | self.versionsButton.setIcon(UI.PixmapCache.getIcon("info")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | self.clearHistoriesButton.setIcon(UI.PixmapCache.getIcon("clearPrivateData")) |
9311 | 85 | self.showMarkersButton.setIcon(UI.PixmapCache.getIcon("select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | 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
|
88 | 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
|
89 | self.testsuitePicker.setSizeAdjustPolicy( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | 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
|
94 | 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
|
95 | self.discoveryPicker.setSizeAdjustPolicy( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | 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
|
100 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | # 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
|
102 | 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
|
103 | 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
|
104 | ) |
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
|
105 | self.__showLogButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | 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
|
107 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
108 | self.__showLogButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
110 | """<b>Show Output...</b""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | """<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
|
112 | """ 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
|
113 | ) |
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 | |
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
|
116 | 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
|
117 | 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
|
118 | ) |
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
|
119 | self.__showCoverageButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
120 | 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
|
121 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
122 | self.__showCoverageButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
123 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
124 | """<b>Show Coverage...</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
125 | """<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
|
126 | """ coverage data.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
127 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
129 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | 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
|
131 | 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
|
132 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
133 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
134 | self.__startButton.setToolTip(self.tr("Start the selected testsuite")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
135 | self.__startButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
137 | """<b>Start Test</b>""" """<p>This button starts the test run.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
139 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
140 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
141 | 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
|
142 | 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
|
143 | ) |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
144 | self.__startFailedButton.setToolTip( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
145 | 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
|
146 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
147 | self.__startFailedButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
148 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
149 | """<b>Rerun Failed</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
150 | """<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
|
151 | """ test run.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
152 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
154 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | 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
|
156 | 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
|
157 | ) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
158 | 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
|
159 | self.__stopButton.setWhatsThis( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | """<b>Stop Test</b>""" """<p>This button stops a running test.</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
163 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
164 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | self.setWindowFlags( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
166 | 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
|
167 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | self.setWindowIcon(UI.PixmapCache.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
|
169 | 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
|
170 | |
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
|
171 | 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
|
172 | # 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
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | # we were called as a 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
|
179 | from VirtualEnv.VirtualenvManager import VirtualenvManager |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | |
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
|
181 | 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
|
182 | self.__venvManager.virtualEnvironmentAdded.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | ) |
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
|
185 | self.__venvManager.virtualEnvironmentRemoved.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
186 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | ) |
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
|
188 | self.__venvManager.virtualEnvironmentChanged.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | self.__populateVenvComboBox |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | ) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
191 | 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
|
192 | |
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
|
193 | self.__project = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | self.__discoverHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | self.__fileHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | self.__testNameHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | self.__recentFramework = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | 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
|
200 | self.__failedTests = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
201 | |
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
|
202 | 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
|
203 | self.__coverageDialog = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
204 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | self.__editors = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | 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
|
207 | self.__recentLog = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | |
9311 | 209 | self.__markersWindow = None |
210 | ||
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | # connect some signals |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | 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
|
213 | 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
|
214 | 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
|
215 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
216 | self.__frameworkRegistry = TestFrameworkRegistry() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | for framework in Frameworks: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | self.__frameworkRegistry.register(framework) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
219 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | self.__setIdleMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
221 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | self.__loadRecent() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | self.__populateVenvComboBox() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | |
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
|
225 | 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
|
226 | 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
|
227 | self.frameworkComboBox.setCurrentText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | self.__project.getProjectTestingFramework() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | ) |
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
|
230 | 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
|
231 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | self.__insertDiscovery("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
233 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
234 | self.__insertTestFile(testfile) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | self.__insertTestName("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
236 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | 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
|
238 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
240 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | def __populateVenvComboBox(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | 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
|
244 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | currentText = self.venvComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | if not currentText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | currentText = self.__recentEnvironment |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
248 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | self.venvComboBox.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | self.venvComboBox.addItem("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
251 | self.venvComboBox.addItems(sorted(self.__venvManager.getVirtualenvNames())) |
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
|
252 | self.venvComboBox.setCurrentText(currentText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
253 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | def __populateTestFrameworkComboBox(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | 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
|
257 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | currentText = self.frameworkComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | if not currentText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | currentText = self.__recentFramework |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | self.frameworkComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
263 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | if bool(self.venvComboBox.currentText()): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | interpreter = self.__venvManager.getVirtualenvInterpreter( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | self.venvComboBox.currentText() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | self.frameworkComboBox.addItem("") |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | 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
|
270 | 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
|
271 | ): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | isInstalled = executor.isInstalled(interpreter) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | entry = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
274 | 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
|
275 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | self.frameworkComboBox.addItem(entry) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
277 | 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
|
278 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | 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
|
280 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
281 | 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
|
282 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
283 | 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
|
284 | result data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
286 | @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
|
287 | @rtype TestResultsModel |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
288 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
289 | return self.__resultsModel |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
290 | |
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
|
291 | 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
|
292 | """ |
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
|
293 | 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
|
294 | |
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
|
295 | @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
|
296 | @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
|
297 | """ |
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
|
298 | 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
|
299 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
300 | 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
|
301 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
302 | 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
|
303 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
304 | @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
|
305 | @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
|
306 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
307 | return self.__failedTests[:] |
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 | @pyqtSlot(str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | 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
|
311 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | 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
|
313 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
314 | @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
|
315 | @type QComboBox or EricComboPathPicker |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | @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
|
317 | @type list of str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | @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
|
319 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | # prepend the given directory to the discovery picker |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | if item is None: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | item = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | if item in history: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | history.remove(item) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | history.insert(0, item) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | widget.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | widget.addItems(history) |
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
|
329 | widget.setEditText(item) |
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 | @pyqtSlot(str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | def __insertDiscovery(self, start): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | 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
|
335 | discoveryPicker object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
336 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | @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
|
338 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
340 | 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
|
341 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | @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
|
343 | 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
|
344 | """ |
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
|
345 | 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
|
346 | |
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
|
347 | @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
|
348 | @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
|
349 | @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
|
350 | (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
|
351 | @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
|
352 | """ |
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
|
353 | 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
|
354 | self.__insertTestFile(testFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
355 | |
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
|
356 | 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
|
357 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
358 | if forProject: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
359 | self.__projectOpened() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
360 | |
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
|
361 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
362 | |
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
|
363 | @pyqtSlot(str) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
364 | 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
|
365 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | 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
|
367 | object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | @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
|
370 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
372 | 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
|
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 __insertTestName(self, testName): |
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 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
|
378 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | @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
|
380 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
382 | 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
|
383 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | def __loadRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | 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
|
387 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | Preferences.Prefs.rsettings.sync() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
389 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | # 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
|
391 | 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
|
392 | recentNameTestEnvironment, "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
393 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | 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
|
395 | recentNameTestFramework, "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
396 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
397 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | # 2. discovery history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | self.__discoverHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
400 | 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
|
401 | if rs is not None: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | recent = [f for f in Preferences.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
|
403 | 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
|
404 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | # 3. test file history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | self.__fileHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
407 | 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
|
408 | if rs is not None: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | recent = [f for f in Preferences.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
|
410 | 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
|
411 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | # 4. test name history |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | self.__testNameHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
414 | 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
|
415 | if rs is not None: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | recent = [n for n in Preferences.toList(rs) if n] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
417 | 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
|
418 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | def __saveRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | 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
|
422 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
424 | recentNameTestEnvironment, self.__recentEnvironment |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
425 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
427 | recentNameTestFramework, self.__recentFramework |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
428 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
430 | recentNameTestDiscoverHistory, self.__discoverHistory |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
431 | ) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
433 | recentNameTestFileHistory, self.__fileHistory |
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 | Preferences.Prefs.rsettings.setValue( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
436 | recentNameTestNameHistory, self.__testNameHistory |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
437 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
438 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | Preferences.Prefs.rsettings.sync() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
440 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | @pyqtSlot() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | def clearRecent(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | 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
|
445 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | # clear histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | self.__discoverHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
448 | self.__fileHistory = [] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | self.__testNameHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
450 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | # clear widgets with histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | self.discoveryPicker.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | self.testsuitePicker.clear() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | self.testComboBox.clear() |
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 | # sync histories |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | self.__saveRecent() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
458 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
459 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
460 | 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
|
461 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
462 | 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
|
463 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
464 | 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
|
465 | self.__runCount = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
467 | 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
|
468 | 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
|
469 | 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
|
470 | self.progressProgressBar.setValue(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
471 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
472 | self.statusLabel.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
473 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
474 | 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
|
475 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
476 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
477 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | def __updateButtonBoxButtons(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
480 | 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
|
481 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
482 | 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
|
483 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | # Start button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
485 | 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
|
486 | self.__startButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
487 | bool(self.venvComboBox.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
488 | and bool(self.frameworkComboBox.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
490 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
491 | self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
492 | and bool(self.discoveryPicker.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
493 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
494 | 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
|
495 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | self.__startButton.setDefault( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
498 | 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
|
499 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | self.__startButton.setEnabled(False) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | self.__startButton.setDefault(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
503 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | # 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
|
505 | self.__startFailedButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
506 | 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
|
507 | ) |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
508 | self.__startFailedButton.setDefault( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
509 | 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
|
510 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
511 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | # Stop button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
513 | 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
|
514 | 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
|
515 | |
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
|
516 | # 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
|
517 | self.__showCoverageButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
518 | self.__mode == TestingWidgetModes.STOPPED |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
519 | and bool(self.__coverageFile) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
520 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
521 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
522 | self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
523 | and bool(self.discoveryPicker.currentText()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
524 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
525 | or bool(self.testsuitePicker.currentText()) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
526 | ) |
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
|
527 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
528 | |
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
|
529 | # 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
|
530 | 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
|
531 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
532 | # Close button |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
533 | 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
|
534 | 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
|
535 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
536 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
537 | @pyqtSlot() |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
538 | def __updateProgress(self): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
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 | Private slot update the progress indicators. |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
541 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
542 | 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
|
543 | 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
|
544 | self.progressProgressBar.setMaximum(self.__totalCount) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
545 | 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
|
546 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
547 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | def __setIdleMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
550 | 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
|
551 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
552 | 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
|
553 | 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
|
554 | self.progressGroupBox.hide() |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
555 | self.tabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
556 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
557 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | def __setRunningMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
560 | 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
|
561 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
562 | self.__mode = TestingWidgetModes.RUNNING |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
563 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
564 | self.__totalCount = 0 |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
565 | self.__runCount = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
566 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
567 | self.__coverageFile = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
568 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
569 | 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
|
570 | self.tabWidget.setCurrentIndex(1) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
571 | self.__updateButtonBoxButtons() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
572 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
573 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
574 | self.progressGroupBox.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
575 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
576 | @pyqtSlot() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | def __setStoppedMode(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | """ |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
579 | 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
|
580 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
581 | 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
|
582 | 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
|
583 | self.progressProgressBar.setMaximum(100) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
584 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
585 | self.progressGroupBox.hide() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
586 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
587 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
588 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
589 | self.testRunStopped.emit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
590 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
591 | self.raise_() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
592 | self.activateWindow() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | |
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
|
594 | @pyqtSlot(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
|
595 | def on_discoverCheckBox_toggled(self, checked): |
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
|
596 | """ |
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
|
597 | 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
|
598 | |
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
|
599 | @param checked state of the checkbox |
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
|
600 | @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
|
601 | """ |
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
|
602 | 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
|
603 | 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
|
604 | 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
|
605 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
606 | self.__insertDiscovery(Preferences.getMultiProject("Workspace")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
607 | |
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
|
608 | self.__resetResults() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
609 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
610 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
611 | 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
|
612 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
613 | 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
|
614 | """ |
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
|
615 | 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
|
616 | # 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
|
617 | py3Extensions = " ".join( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
618 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
619 | "*{0}".format(ext) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
620 | for ext in ericApp() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
621 | .getObject("DebugServer") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
622 | .getExtensions("Python3") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
623 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
624 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
625 | 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
|
626 | py3Extensions |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
627 | ) |
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
|
628 | 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
|
629 | # 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
|
630 | 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
|
631 | self.testsuitePicker.setFilters(fileFilter) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
632 | |
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
|
633 | 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
|
634 | self.__project.getProjectPath() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
635 | 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
|
636 | 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
|
637 | ) |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
638 | 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
|
639 | 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
|
640 | self.testsuitePicker.setDefaultDirectory(defaultDirectory) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
641 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | @pyqtSlot(QAbstractButton) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | 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
|
644 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | 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
|
646 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | @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
|
648 | @type QAbstractButton |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
649 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | if button == self.__startButton: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | self.startTests() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | self.__saveRecent() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | elif button == self.__stopButton: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | 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
|
655 | elif button == self.__startFailedButton: |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
656 | self.startTests(failedOnly=True) |
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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | self.__showLogOutput() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
661 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | @pyqtSlot(int) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
663 | 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
|
664 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
665 | 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
|
666 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
667 | @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
|
668 | @type int |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
670 | self.__populateTestFrameworkComboBox() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
671 | self.__updateButtonBoxButtons() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
672 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | 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
|
674 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
675 | self.__updateCoverage() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
676 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
677 | @pyqtSlot(int) |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
678 | def on_frameworkComboBox_currentIndexChanged(self, index): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
679 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
680 | 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
|
681 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
682 | @param index index of the selected framework |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
683 | @type int |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
684 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
685 | self.__resetResults() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
686 | self.__updateCoverage() |
9311 | 687 | self.__updateMarkerSupport() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
688 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
689 | @pyqtSlot() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
690 | def __updateCoverage(self): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
691 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
692 | 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
|
693 | the selected framework's capabilities. |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
694 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
695 | hasCoverage = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
696 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
697 | venvName = self.venvComboBox.currentText() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
698 | if venvName: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
699 | framework = self.frameworkComboBox.currentText() |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
700 | if framework: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
701 | interpreter = self.__venvManager.getVirtualenvInterpreter(venvName) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
702 | executor = self.__frameworkRegistry.createExecutor(framework, self) |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
703 | hasCoverage = executor.hasCoverage(interpreter) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
704 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
705 | self.coverageCheckBox.setEnabled(hasCoverage) |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
706 | if not hasCoverage: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
707 | self.coverageCheckBox.setChecked(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
708 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
709 | @pyqtSlot() |
9311 | 710 | def __updateMarkerSupport(self): |
711 | """ | |
712 | Private slot to update the state of the marker related widgets depending on | |
713 | the selected framework's capabilities. | |
714 | """ | |
715 | supportsMarkers = False | |
716 | ||
717 | venvName = self.venvComboBox.currentText() | |
718 | if venvName: | |
719 | framework = self.frameworkComboBox.currentText() | |
720 | if framework: | |
721 | interpreter = self.__venvManager.getVirtualenvInterpreter(venvName) | |
722 | executor = self.__frameworkRegistry.createExecutor(framework, self) | |
723 | supportsMarkers = executor.supportsMarkers(interpreter) | |
724 | ||
725 | # 1. marker expression line edit | |
726 | self.markerExpressionEdit.setEnabled(supportsMarkers) | |
727 | if not supportsMarkers: | |
728 | self.markerExpressionEdit.clear() | |
729 | ||
730 | # 2. show markers button | |
731 | self.showMarkersButton.setEnabled(supportsMarkers) | |
732 | if self.__markersWindow is not None: | |
733 | self.__markersWindow.close() | |
734 | ||
735 | @pyqtSlot() | |
736 | def on_showMarkersButton_clicked(self): | |
737 | """ | |
738 | Private slot to show a window containing the list of defined markers. | |
739 | """ | |
740 | venvName = self.venvComboBox.currentText() | |
741 | if venvName: | |
742 | framework = self.frameworkComboBox.currentText() | |
743 | if framework: | |
744 | if self.discoverCheckBox.isChecked(): | |
745 | workdir = self.discoveryPicker.currentText() | |
746 | elif self.testsuitePicker.currentText(): | |
747 | workdir = os.path.dirname(self.testsuitePicker.currentText()) | |
748 | else: | |
749 | workdir = "" | |
750 | ||
751 | interpreter = self.__venvManager.getVirtualenvInterpreter(venvName) | |
752 | executor = self.__frameworkRegistry.createExecutor(framework, self) | |
753 | markers = executor.getMarkers(interpreter, workdir) | |
754 | ||
755 | if self.__markersWindow is None: | |
756 | from .MarkersWindow import MarkersWindow | |
757 | ||
758 | self.__markersWindow = MarkersWindow() | |
759 | self.__markersWindow.showMarkers(markers) | |
760 | ||
761 | @pyqtSlot() | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
762 | 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
|
763 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
764 | 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
|
765 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
766 | venvName = self.venvComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
767 | if venvName: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | 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
|
769 | versionsText = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
770 | interpreter = self.__venvManager.getVirtualenvInterpreter(venvName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
771 | for framework in sorted(self.__frameworkRegistry.getFrameworks().keys()): |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
772 | 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
|
773 | versions = executor.getVersions(interpreter) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
774 | if versions: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
775 | 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
|
776 | versions["name"], versions["version"] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
777 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
778 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | if versions["plugins"]: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
780 | txt += "<table>" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
781 | 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
|
782 | 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
|
783 | pluginVersion["name"], pluginVersion["version"] |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | ) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | txt += "</table>" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | txt += "</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
787 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
788 | versionsText += txt |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
789 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | if not versionsText: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | 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
|
792 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | EricMessageBox.information( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
794 | 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
|
795 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
796 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
797 | @pyqtSlot() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
798 | def startTests(self, failedOnly=False): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | 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
|
801 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | @param failedOnly flag indicating to run only failed tests |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
803 | @type bool |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | """ |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
805 | if self.__mode == TestingWidgetModes.RUNNING: |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
806 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
807 | |
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
|
808 | self.__recentLog = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | 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
|
811 | 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
|
812 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
813 | 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
|
814 | discover = self.discoverCheckBox.isChecked() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | if discover: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | discoveryStart = self.discoveryPicker.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | testFileName = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | testName = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
819 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | if discoveryStart: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | self.__insertDiscovery(discoveryStart) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | else: |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | discoveryStart = "" |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
824 | testFileName = self.testsuitePicker.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | if testFileName: |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
826 | self.__insertTestFile(testFileName) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | testName = self.testComboBox.currentText() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | if testName: |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
829 | self.__insertTestName(testName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
830 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
831 | 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
|
832 | QCoreApplication.processEvents() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
833 | |
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
|
834 | 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
|
835 | mainScript = self.__project.getMainScript(True) |
9084
ee36935f4edd
Corrected some little issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9081
diff
changeset
|
836 | coverageFile = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
837 | 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
|
838 | ) |
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
|
839 | 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
|
840 | coverageFile = "" |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | interpreter = self.__venvManager.getVirtualenvInterpreter( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
842 | self.__recentEnvironment |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
843 | ) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
844 | config = TestConfig( |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
845 | 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
|
846 | discover=discover, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
847 | discoveryStart=discoveryStart, |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
848 | testFilename=testFileName, |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
849 | testName=testName, |
9311 | 850 | 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
|
851 | 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
|
852 | failedOnly=failedOnly, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
853 | collectCoverage=self.coverageCheckBox.isChecked(), |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
854 | 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
|
855 | coverageFile=coverageFile, |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
856 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
857 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | 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
|
859 | self.__recentFramework, self |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
860 | ) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
861 | 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
|
862 | 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
|
863 | 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
|
864 | 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
|
865 | 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
|
866 | 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
|
867 | 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
|
868 | 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
|
869 | self.__testExecutor.testRunAboutToBeStarted.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
870 | self.__testRunAboutToBeStarted |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
871 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
872 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
873 | self.__setRunningMode() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
874 | self.__testExecutor.start(config, []) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
875 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
876 | @pyqtSlot() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
877 | def __stopTests(self): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
878 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
879 | 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
|
880 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
881 | self.__testExecutor.stopIfRunning() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
882 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
883 | @pyqtSlot(list) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
884 | 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
|
885 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | 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
|
887 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
888 | @param testNames list of tuples containing the test id, the test name |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
889 | and a description of collected tests |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
890 | @type list of 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
|
891 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
892 | 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
|
893 | TestResult( |
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
894 | category=TestResultCategory.PENDING, |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
895 | status=self.tr("pending"), |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
896 | name=name, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
897 | id=id, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
898 | message=desc, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
899 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
900 | for id, name, desc in testNames |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
901 | ] |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
902 | self.__resultsModel.addTestResults(testResults) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
903 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
904 | self.__totalCount += len(testResults) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
905 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
906 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
907 | @pyqtSlot(list) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | def __testsCollectError(self, errors): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
909 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
910 | 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
|
911 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | @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
|
913 | of the error |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | @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
|
915 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
916 | testResults = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
917 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
918 | for testFile, error in errors: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
919 | if testFile: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
920 | testResults.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
921 | TestResult( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
922 | category=TestResultCategory.FAIL, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
923 | status=self.tr("Failure"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
924 | name=testFile, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
925 | id=testFile, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
926 | message=self.tr("Collection Error"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
927 | extra=error.splitlines(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
928 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
929 | ) |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
930 | else: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
931 | EricMessageBox.critical( |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
932 | self, |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
933 | self.tr("Collection Error"), |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
934 | self.tr( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
935 | "<p>There was an error while collecting tests." "</p><p>{0}</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
936 | ).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
|
937 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
938 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
939 | if testResults: |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
940 | self.__resultsModel.addTestResults(testResults) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
941 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
942 | @pyqtSlot(tuple) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
943 | 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
|
944 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | 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
|
946 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
947 | @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
|
948 | tests about to be run |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
949 | @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
|
950 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
951 | self.__resultsModel.updateTestResults( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
952 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
953 | TestResult( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
954 | category=TestResultCategory.RUNNING, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
955 | status=self.tr("running"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
956 | id=test[0], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
957 | name=test[1], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
958 | 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
|
959 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
960 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
961 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
962 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
963 | @pyqtSlot(TestResult) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
964 | def __processTestResult(self, result): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
965 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
966 | 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
|
967 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
968 | @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
|
969 | @type TestResult |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
970 | """ |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
971 | if not result.subtestResult: |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
972 | self.__runCount += 1 |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
973 | self.__updateProgress() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
974 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
975 | self.__resultsModel.updateTestResults([result]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
976 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
977 | @pyqtSlot(list, str) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
978 | def __testProcessFinished(self, results, output): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
979 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
980 | 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
|
981 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
982 | @param results list of test result objects (if not sent via the |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | 'testResult' signal |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
984 | @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
|
985 | @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
|
986 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | """ |
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
|
988 | self.__recentLog = output |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
989 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
990 | self.__setStoppedMode() |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
991 | self.__testExecutor = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
992 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
993 | self.__adjustPendingState() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
994 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
995 | @pyqtSlot(int, float) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
996 | def __testRunFinished(self, noTests, duration): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
997 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
998 | 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
|
999 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1000 | @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
|
1001 | @type int |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1002 | @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
|
1003 | @type float |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1004 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1005 | self.sbLabel.setText( |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1006 | 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
|
1007 | 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
|
1008 | ) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1009 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1011 | self.__setStoppedMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1012 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1013 | @pyqtSlot() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1014 | def __testsStopped(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1015 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1016 | 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
|
1017 | """ |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1018 | 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
|
1019 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1020 | self.__setStoppedMode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1021 | |
9064
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1022 | @pyqtSlot() |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1023 | 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
|
1024 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1025 | 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
|
1026 | executor. |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1027 | """ |
339bb8c8007d
Implemented the "Rerun Failed" functionality for the new unit test interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9063
diff
changeset
|
1028 | self.__resultsModel.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1029 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1030 | def __adjustPendingState(self): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1031 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1032 | 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
|
1033 | tests to "not run". |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1034 | """ |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1035 | newResults = [] |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1036 | for result in self.__resultsModel.getTestResults(): |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1037 | if result.category == TestResultCategory.PENDING: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1038 | result.category = TestResultCategory.SKIP |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1039 | result.status = self.tr("not run") |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1040 | newResults.append(result) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1041 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1042 | if newResults: |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1043 | self.__resultsModel.updateTestResults(newResults) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1044 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1045 | @pyqtSlot(str) |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1046 | def __coverageData(self, coverageFile): |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1047 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1048 | 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
|
1049 | |
9062
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1050 | @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
|
1051 | @type str |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1052 | """ |
7f27bf3b50c3
Implemented most of the 'unittest' executor and runner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9059
diff
changeset
|
1053 | self.__coverageFile = coverageFile |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1054 | |
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
|
1055 | @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
|
1056 | 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
|
1057 | """ |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1058 | 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
|
1059 | 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
|
1060 | """ |
eab09a1ab8ce
Implemented the "Show Coverage" functionality and corrected the coverage related code in UnittestRunner.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9066
diff
changeset
|
1061 | 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
|
1062 | from DataViews.PyCoverageDialog import PyCoverageDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1063 | |
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
|
1064 | 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
|
1065 | 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
|
1066 | |
9089
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1067 | testDir = ( |
b48a6d0f6309
Implemented support for the 'pytest' framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9084
diff
changeset
|
1068 | self.discoveryPicker.currentText() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1069 | if self.discoverCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1070 | 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
|
1071 | ) |
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
|
1072 | 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
|
1073 | 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
|
1074 | 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
|
1075 | |
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
|
1076 | @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
|
1077 | 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
|
1078 | """ |
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
|
1079 | 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
|
1080 | """ |
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
|
1081 | from EricWidgets.EricPlainTextDialog import EricPlainTextDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1082 | |
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
|
1083 | dlg = EricPlainTextDialog( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1084 | title=self.tr("Test Run Output"), text=self.__recentLog |
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
|
1085 | ) |
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
|
1086 | dlg.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1087 | |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1088 | @pyqtSlot(str) |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1089 | def __setStatusLabel(self, statusText): |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1090 | """ |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1091 | 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
|
1092 | |
9063
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1093 | @param statusText text to be shown |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1094 | @type str |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1095 | """ |
f1d7dd7ae471
Corrected the code dealing with subtests.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9062
diff
changeset
|
1096 | 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
|
1097 | |
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
|
1098 | @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
|
1099 | 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
|
1100 | """ |
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
|
1101 | 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
|
1102 | """ |
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
|
1103 | 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
|
1104 | self.frameworkComboBox.setCurrentText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1105 | self.__project.getProjectTestingFramework() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1106 | ) |
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
|
1107 | 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
|
1108 | |
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
|
1109 | @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
|
1110 | 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
|
1111 | """ |
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
|
1112 | 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
|
1113 | """ |
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
|
1114 | self.venvComboBox.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
|
1115 | 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
|
1116 | self.__insertDiscovery("") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1117 | |
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
|
1118 | @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
|
1119 | 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
|
1120 | """ |
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
|
1121 | 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
|
1122 | |
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
|
1123 | @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
|
1124 | @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
|
1125 | @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
|
1126 | @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
|
1127 | """ |
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
|
1128 | 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
|
1129 | # 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
|
1130 | 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
|
1131 | 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
|
1132 | self.__openEditor(filename, lineno) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1133 | |
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
|
1134 | 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
|
1135 | """ |
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
|
1136 | 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
|
1137 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1138 | 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
|
1139 | 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
|
1140 | |
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
|
1141 | @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
|
1142 | @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
|
1143 | @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
|
1144 | @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
|
1145 | """ |
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
|
1146 | from QScintilla.MiniEditor import MiniEditor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1147 | |
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
|
1148 | 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
|
1149 | 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
|
1150 | editor.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1151 | |
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
|
1152 | self.__editors.append(editor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1153 | |
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
|
1154 | 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
|
1155 | """ |
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
|
1156 | 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
|
1157 | |
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
|
1158 | @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
|
1159 | @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
|
1160 | """ |
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
|
1161 | event.accept() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1162 | |
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
|
1163 | for editor in self.__editors: |
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
|
1164 | with contextlib.suppress(Exception): |
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
|
1165 | editor.close() |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1166 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1167 | |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1168 | class TestingWindow(EricMainWindow): |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1169 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1170 | 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
|
1171 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1172 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1173 | 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
|
1174 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1175 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1176 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | @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
|
1178 | @type str |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1179 | @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
|
1180 | @type QWidget |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1181 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1182 | super().__init__(parent) |
9066
a219ade50f7c
Performed some refactoring to avoid possible name clashes on case-insensitive systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9065
diff
changeset
|
1183 | self.__cw = TestingWidget(testfile=testfile, parent=self) |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | self.__cw.installEventFilter(self) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1185 | size = self.__cw.size() |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1186 | self.setCentralWidget(self.__cw) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1187 | self.resize(size) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1188 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1189 | self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1190 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1191 | 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
|
1192 | 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
|
1193 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1194 | def eventFilter(self, obj, event): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1195 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1196 | 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
|
1197 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1198 | @param obj reference to the object the event is meant for (QObject) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1199 | @param event reference to the event object (QEvent) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1200 | @return flag indicating, whether the event was handled (boolean) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1201 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1202 | 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
|
1203 | QCoreApplication.exit(0) |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1204 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1205 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1206 | return False |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1207 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1208 | |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1209 | def clearSavedHistories(self): |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1210 | """ |
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | 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
|
1212 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1213 | Preferences.Prefs.rsettings.setValue(recentNameTestDiscoverHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1214 | Preferences.Prefs.rsettings.setValue(recentNameTestFileHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1215 | Preferences.Prefs.rsettings.setValue(recentNameTestNameHistory, []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1216 | |
9059
e7fd342f8bfc
Implemented the basic functionality of the new unit test framework.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1217 | Preferences.Prefs.rsettings.sync() |