13 import os |
13 import os |
14 |
14 |
15 from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent, QCoreApplication |
15 from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent, QCoreApplication |
16 from PyQt6.QtWidgets import QAbstractButton, QComboBox, QDialogButtonBox, QWidget |
16 from PyQt6.QtWidgets import QAbstractButton, QComboBox, QDialogButtonBox, QWidget |
17 |
17 |
18 from EricWidgets import EricMessageBox |
18 from eric7.EricWidgets import EricMessageBox |
19 from EricWidgets.EricApplication import ericApp |
19 from eric7.EricWidgets.EricApplication import ericApp |
20 from EricWidgets.EricMainWindow import EricMainWindow |
20 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
21 from EricWidgets.EricPathPicker import EricPathPickerModes |
21 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
22 |
22 |
23 from .Ui_TestingWidget import Ui_TestingWidget |
23 from .Ui_TestingWidget import Ui_TestingWidget |
24 |
24 |
25 from .TestResultsTree import TestResultsModel, TestResultsTreeView |
25 from .TestResultsTree import TestResultsModel, TestResultsTreeView |
26 from .Interfaces import Frameworks |
26 from .Interfaces import Frameworks |
27 from .Interfaces.TestExecutorBase import TestConfig, TestResult, TestResultCategory |
27 from .Interfaces.TestExecutorBase import TestConfig, TestResult, TestResultCategory |
28 from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry |
28 from .Interfaces.TestFrameworkRegistry import TestFrameworkRegistry |
29 |
29 |
30 import Preferences |
30 from eric7 import Preferences |
31 import UI.PixmapCache |
31 from eric7.EricGui import EricPixmapCache |
32 |
32 |
33 from Globals import ( |
33 from eric7.Globals import ( |
34 recentNameTestDiscoverHistory, |
34 recentNameTestDiscoverHistory, |
35 recentNameTestFileHistory, |
35 recentNameTestFileHistory, |
36 recentNameTestNameHistory, |
36 recentNameTestNameHistory, |
37 recentNameTestFramework, |
37 recentNameTestFramework, |
38 recentNameTestEnvironment, |
38 recentNameTestEnvironment, |
78 self.__resultsTree = TestResultsTreeView(self) |
78 self.__resultsTree = TestResultsTreeView(self) |
79 self.__resultsTree.setModel(self.__resultsModel) |
79 self.__resultsTree.setModel(self.__resultsModel) |
80 self.__resultsTree.goto.connect(self.__showSource) |
80 self.__resultsTree.goto.connect(self.__showSource) |
81 self.resultsGroupBox.layout().addWidget(self.__resultsTree) |
81 self.resultsGroupBox.layout().addWidget(self.__resultsTree) |
82 |
82 |
83 self.versionsButton.setIcon(UI.PixmapCache.getIcon("info")) |
83 self.versionsButton.setIcon(EricPixmapCache.getIcon("info")) |
84 self.clearHistoriesButton.setIcon(UI.PixmapCache.getIcon("clearPrivateData")) |
84 self.clearHistoriesButton.setIcon(EricPixmapCache.getIcon("clearPrivateData")) |
85 self.showMarkersButton.setIcon(UI.PixmapCache.getIcon("select")) |
85 self.showMarkersButton.setIcon(EricPixmapCache.getIcon("select")) |
86 |
86 |
87 self.testsuitePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
87 self.testsuitePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
88 self.testsuitePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
88 self.testsuitePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
89 self.testsuitePicker.setSizeAdjustPolicy( |
89 self.testsuitePicker.setSizeAdjustPolicy( |
90 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
90 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
163 ) |
163 ) |
164 |
164 |
165 self.setWindowFlags( |
165 self.setWindowFlags( |
166 self.windowFlags() | Qt.WindowType.WindowContextHelpButtonHint |
166 self.windowFlags() | Qt.WindowType.WindowContextHelpButtonHint |
167 ) |
167 ) |
168 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
168 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
169 self.setWindowTitle(self.tr("Testing")) |
169 self.setWindowTitle(self.tr("Testing")) |
170 |
170 |
171 try: |
171 try: |
172 # we are called from within the eric IDE |
172 # we are called from within the eric IDE |
173 self.__venvManager = ericApp().getObject("VirtualEnvManager") |
173 self.__venvManager = ericApp().getObject("VirtualEnvManager") |
175 self.__project.projectOpened.connect(self.__projectOpened) |
175 self.__project.projectOpened.connect(self.__projectOpened) |
176 self.__project.projectClosed.connect(self.__projectClosed) |
176 self.__project.projectClosed.connect(self.__projectClosed) |
177 self.__projectEnvironmentMarker = self.tr("<project>") |
177 self.__projectEnvironmentMarker = self.tr("<project>") |
178 except KeyError: |
178 except KeyError: |
179 # we were called as a standalone application |
179 # we were called as a standalone application |
180 from VirtualEnv.VirtualenvManager import VirtualenvManager |
180 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
181 |
181 |
182 self.__venvManager = VirtualenvManager(self) |
182 self.__venvManager = VirtualenvManager(self) |
183 self.__venvManager.virtualEnvironmentAdded.connect( |
183 self.__venvManager.virtualEnvironmentAdded.connect( |
184 self.__populateVenvComboBox |
184 self.__populateVenvComboBox |
185 ) |
185 ) |
1092 """ |
1092 """ |
1093 Private slot to show a code coverage dialog for the most recent test |
1093 Private slot to show a code coverage dialog for the most recent test |
1094 run. |
1094 run. |
1095 """ |
1095 """ |
1096 if self.__coverageDialog is None: |
1096 if self.__coverageDialog is None: |
1097 from DataViews.PyCoverageDialog import PyCoverageDialog |
1097 from eric7.DataViews.PyCoverageDialog import PyCoverageDialog |
1098 |
1098 |
1099 self.__coverageDialog = PyCoverageDialog(self) |
1099 self.__coverageDialog = PyCoverageDialog(self) |
1100 self.__coverageDialog.openFile.connect(self.__openEditor) |
1100 self.__coverageDialog.openFile.connect(self.__openEditor) |
1101 |
1101 |
1102 testDir = ( |
1102 testDir = ( |
1111 @pyqtSlot() |
1111 @pyqtSlot() |
1112 def __showLogOutput(self): |
1112 def __showLogOutput(self): |
1113 """ |
1113 """ |
1114 Private slot to show the output of the most recent test run. |
1114 Private slot to show the output of the most recent test run. |
1115 """ |
1115 """ |
1116 from EricWidgets.EricPlainTextDialog import EricPlainTextDialog |
1116 from eric7.EricWidgets.EricPlainTextDialog import EricPlainTextDialog |
1117 |
1117 |
1118 dlg = EricPlainTextDialog( |
1118 dlg = EricPlainTextDialog( |
1119 title=self.tr("Test Run Output"), text=self.__recentLog |
1119 title=self.tr("Test Run Output"), text=self.__recentLog |
1120 ) |
1120 ) |
1121 dlg.exec() |
1121 dlg.exec() |
1178 @param filename path of the file to be opened |
1178 @param filename path of the file to be opened |
1179 @type str |
1179 @type str |
1180 @param linenumber line number to place the cursor at (defaults to 1) |
1180 @param linenumber line number to place the cursor at (defaults to 1) |
1181 @type int (optional) |
1181 @type int (optional) |
1182 """ |
1182 """ |
1183 from QScintilla.MiniEditor import MiniEditor |
1183 from eric7.QScintilla.MiniEditor import MiniEditor |
1184 |
1184 |
1185 editor = MiniEditor(filename, "Python3", self) |
1185 editor = MiniEditor(filename, "Python3", self) |
1186 editor.gotoLine(linenumber) |
1186 editor.gotoLine(linenumber) |
1187 editor.show() |
1187 editor.show() |
1188 |
1188 |