PyUnit/UnittestDialog.py

changeset 6904
3f35037a08d4
parent 6902
67d0ad66b59a
child 6905
889339ffe6cf
equal deleted inserted replaced
6903:0d4e1033731b 6904:3f35037a08d4
117 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 117 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
118 self.setWindowTitle(self.tr("Unittest")) 118 self.setWindowTitle(self.tr("Unittest"))
119 if dbs: 119 if dbs:
120 self.ui = ui 120 self.ui = ui
121 121
122 self.debuggerCheckBox.setChecked(True)
123
122 # virtual environment manager is only used in the integrated 124 # virtual environment manager is only used in the integrated
123 # variant 125 # variant
124 self.__venvManager = e5App().getObject("VirtualEnvManager") 126 self.__venvManager = e5App().getObject("VirtualEnvManager")
125 self.__populateVenvComboBox() 127 self.__populateVenvComboBox()
126 self.__venvManager.virtualEnvironmentAdded.connect( 128 self.__venvManager.virtualEnvironmentAdded.connect(
129 self.__populateVenvComboBox) 131 self.__populateVenvComboBox)
130 self.__venvManager.virtualEnvironmentChanged.connect( 132 self.__venvManager.virtualEnvironmentChanged.connect(
131 self.__populateVenvComboBox) 133 self.__populateVenvComboBox)
132 else: 134 else:
133 self.__venvManager = None 135 self.__venvManager = None
136 self.debuggerCheckBox.setVisible(False)
134 self.venvComboBox.setVisible(bool(self.__venvManager)) 137 self.venvComboBox.setVisible(bool(self.__venvManager))
135 self.venvLabel.setVisible(bool(self.__venvManager)) 138 self.venvLabel.setVisible(bool(self.__venvManager))
136 139
137 self.__setProgressColor("green") 140 self.__setProgressColor("green")
138 self.progressLed.setDarkFactor(150) 141 self.progressLed.setDarkFactor(150)
568 571
569 return selectedTests 572 return selectedTests
570 573
571 def __UTDiscovered(self, testCases, exc_type, exc_value): 574 def __UTDiscovered(self, testCases, exc_type, exc_value):
572 """ 575 """
573 Private slot to handle the utPrepared signal. 576 Private slot to handle the utDiscovered signal.
574 577
575 If the unittest suite was loaded successfully, we ask the 578 If the unittest suite was loaded successfully, we ask the
576 client to run the test suite. 579 client to run the test suite.
577 580
578 @param testCases list of detected test cases 581 @param testCases list of detected test cases
719 self.coverageCheckBox.isChecked(), coverageFile, 722 self.coverageCheckBox.isChecked(), coverageFile,
720 self.coverageEraseCheckBox.isChecked(), clientType=clientType, 723 self.coverageEraseCheckBox.isChecked(), clientType=clientType,
721 forProject=self.__forProject, workdir=workdir, 724 forProject=self.__forProject, workdir=workdir,
722 venvName=venvName, syspath=sysPath, 725 venvName=venvName, syspath=sysPath,
723 discover=discover, discoveryStart=discoveryStart, 726 discover=discover, discoveryStart=discoveryStart,
724 testCases=testCases) 727 testCases=testCases, debug=self.debuggerCheckBox.isChecked())
725 else: 728 else:
726 # we are running as an application 729 # we are running as an application
727 if discover and not discoveryStart: 730 if discover and not discoveryStart:
728 E5MessageBox.critical( 731 E5MessageBox.critical(
729 self, 732 self,
809 if self.coverageEraseCheckBox.isChecked(): 812 if self.coverageEraseCheckBox.isChecked():
810 cover.erase() 813 cover.erase()
811 else: 814 else:
812 cover = None 815 cover = None
813 816
814 self.testResult = QtTestResult(self) 817 self.testResult = QtTestResult(
818 self, self.failfastCheckBox.isChecked())
815 self.totalTests = test.countTestCases() 819 self.totalTests = test.countTestCases()
816 self.__failedTests = [] 820 self.__failedTests = []
817 self.__setRunningMode() 821 self.__setRunningMode()
818 if cover: 822 if cover:
819 cover.start() 823 cover.start()
847 ) 851 )
848 return 852 return
849 853
850 self.totalTests = nrTests 854 self.totalTests = nrTests
851 self.__setRunningMode() 855 self.__setRunningMode()
852 self.__dbs.remoteUTRun() 856 self.__dbs.remoteUTRun(debug=self.debuggerCheckBox.isChecked(),
857 failfast=self.failfastCheckBox.isChecked())
853 858
854 @pyqtSlot() 859 @pyqtSlot()
855 def __stopTests(self): 860 def __stopTests(self):
856 """ 861 """
857 Private slot to stop the test. 862 Private slot to stop the test.
945 self.tr("Ran %n test(s) in {0:.3f}s", "", self.runCount) 950 self.tr("Ran %n test(s) in {0:.3f}s", "", self.runCount)
946 .format(self.timeTaken)) 951 .format(self.timeTaken))
947 self.progressLed.off() 952 self.progressLed.off()
948 953
949 self.unittestStopped.emit() 954 self.unittestStopped.emit()
955
956 self.raise_()
957 self.activateWindow()
950 958
951 def testFailed(self, test, exc, testId): 959 def testFailed(self, test, exc, testId):
952 """ 960 """
953 Public method called if a test fails. 961 Public method called if a test fails.
954 962
1160 """ 1168 """
1161 A TestResult derivative to work with a graphical GUI. 1169 A TestResult derivative to work with a graphical GUI.
1162 1170
1163 For more details see pyunit.py of the standard Python distribution. 1171 For more details see pyunit.py of the standard Python distribution.
1164 """ 1172 """
1165 def __init__(self, parent): 1173 def __init__(self, parent, failfast):
1166 """ 1174 """
1167 Constructor 1175 Constructor
1168 1176
1169 @param parent The parent widget. 1177 @param parent reference to the parent widget
1178 @type UnittestDialog
1179 @param failfast flag indicating to stop at the first error
1180 @type bool
1170 """ 1181 """
1171 super(QtTestResult, self).__init__() 1182 super(QtTestResult, self).__init__()
1172 self.parent = parent 1183 self.parent = parent
1184 self.failfast = failfast
1173 1185
1174 def addFailure(self, test, err): 1186 def addFailure(self, test, err):
1175 """ 1187 """
1176 Public method called if a test failed. 1188 Public method called if a test failed.
1177 1189

eric ide

mercurial