eric7/Testing/TestingWidget.py

branch
unittest
changeset 9093
437bfe0c5793
parent 9089
b48a6d0f6309
child 9192
a763d57e23bc
--- a/eric7/Testing/TestingWidget.py	Mon May 23 16:50:39 2022 +0200
+++ b/eric7/Testing/TestingWidget.py	Mon May 23 17:18:58 2022 +0200
@@ -100,6 +100,16 @@
         self.testComboBox.lineEdit().setClearButtonEnabled(True)
         
         # create some more dialog buttons for orchestration
+        self.__showLogButton = self.buttonBox.addButton(
+            self.tr("Show Output..."),
+            QDialogButtonBox.ButtonRole.ActionRole)
+        self.__showLogButton.setToolTip(
+            self.tr("Show the output of the test runner process"))
+        self.__showLogButton.setWhatsThis(self.tr(
+            """<b>Show Output...</b"""
+            """<p>This button opens a dialog containing the output of the"""
+            """ test runner process of the most recent run.</p>"""))
+        
         self.__showCoverageButton = self.buttonBox.addButton(
             self.tr("Show Coverage..."),
             QDialogButtonBox.ButtonRole.ActionRole)
@@ -174,6 +184,7 @@
         
         self.__editors = []
         self.__testExecutor = None
+        self.__recentLog = ""
         
         # connect some signals
         self.discoveryPicker.editTextChanged.connect(
@@ -504,6 +515,9 @@
             )
         )
         
+        # Log output button
+        self.__showLogButton.setEnabled(bool(self.__recentLog))
+        
         # Close button
         self.buttonBox.button(
             QDialogButtonBox.StandardButton.Close
@@ -633,6 +647,8 @@
             self.startTests(failedOnly=True)
         elif button == self.__showCoverageButton:
             self.__showCoverageDialog()
+        elif button == self.__showLogButton:
+            self.__showLogOutput()
     
     @pyqtSlot(int)
     def on_venvComboBox_currentIndexChanged(self, index):
@@ -736,6 +752,8 @@
         if self.__mode == TestingWidgetModes.RUNNING:
             return
         
+        self.__recentLog = ""
+        
         self.__recentEnvironment = self.venvComboBox.currentText()
         self.__recentFramework = self.frameworkComboBox.currentText()
         
@@ -912,6 +930,8 @@
         @param output string containing the test process output (if any)
         @type str
         """
+        self.__recentLog = output
+        
         self.__setStoppedMode()
         self.__testExecutor = None
         
@@ -997,6 +1017,18 @@
             self.__coverageDialog.show()
             self.__coverageDialog.start(self.__coverageFile, testDir)
     
+    @pyqtSlot()
+    def __showLogOutput(self):
+        """
+        Private slot to show the output of the most recent test run.
+        """
+        from EricWidgets.EricPlainTextDialog import EricPlainTextDialog
+        dlg = EricPlainTextDialog(
+            title=self.tr("Test Run Output"),
+            text=self.__recentLog
+        )
+        dlg.exec()
+    
     @pyqtSlot(str)
     def __setStatusLabel(self, statusText):
         """

eric ide

mercurial