PyUnit/UnittestDialog.py

changeset 537
72b32daeb8d6
parent 518
2b991e88765e
child 564
b3d966393ba9
equal deleted inserted replaced
536:6d8d39753c82 537:72b32daeb8d6
17 from PyQt4.QtCore import * 17 from PyQt4.QtCore import *
18 from PyQt4.QtGui import * 18 from PyQt4.QtGui import *
19 19
20 from E5Gui.E5Application import e5App 20 from E5Gui.E5Application import e5App
21 from E5Gui.E5Completers import E5FileCompleter 21 from E5Gui.E5Completers import E5FileCompleter
22 from E5Gui import E5MessageBox
22 23
23 from .Ui_UnittestDialog import Ui_UnittestDialog 24 from .Ui_UnittestDialog import Ui_UnittestDialog
24 from .Ui_UnittestStacktraceDialog import Ui_UnittestStacktraceDialog 25 from .Ui_UnittestStacktraceDialog import Ui_UnittestStacktraceDialog
25 26
26 from DebugClients.Python3.coverage import coverage 27 from DebugClients.Python3.coverage import coverage
208 if self.running: 209 if self.running:
209 return 210 return
210 211
211 prog = self.testsuiteComboBox.currentText() 212 prog = self.testsuiteComboBox.currentText()
212 if not prog: 213 if not prog:
213 QMessageBox.critical(self, 214 E5MessageBox.critical(self,
214 self.trUtf8("Unittest"), 215 self.trUtf8("Unittest"),
215 self.trUtf8("You must enter a test suite file.")) 216 self.trUtf8("You must enter a test suite file."))
216 return 217 return
217 218
218 # prepend the selected file to the testsuite combobox 219 # prepend the selected file to the testsuite combobox
255 testFunctionName, module) 256 testFunctionName, module)
256 except AttributeError: 257 except AttributeError:
257 test = unittest.defaultTestLoader.loadTestsFromModule(module) 258 test = unittest.defaultTestLoader.loadTestsFromModule(module)
258 except: 259 except:
259 exc_type, exc_value, exc_tb = sys.exc_info() 260 exc_type, exc_value, exc_tb = sys.exc_info()
260 QMessageBox.critical(self, 261 E5MessageBox.critical(self,
261 self.trUtf8("Unittest"), 262 self.trUtf8("Unittest"),
262 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") 263 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>")
263 .format(self.testName, str(exc_type), str(exc_value))) 264 .format(self.testName, str(exc_type), str(exc_value)))
264 return 265 return
265 266
304 @param nrTests number of tests contained in the test suite (integer) 305 @param nrTests number of tests contained in the test suite (integer)
305 @param exc_type type of exception occured during preparation (string) 306 @param exc_type type of exception occured during preparation (string)
306 @param exc_value value of exception occured during preparation (string) 307 @param exc_value value of exception occured during preparation (string)
307 """ 308 """
308 if nrTests == 0: 309 if nrTests == 0:
309 QMessageBox.critical(self, 310 E5MessageBox.critical(self,
310 self.trUtf8("Unittest"), 311 self.trUtf8("Unittest"),
311 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") 312 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>")
312 .format(self.testName, exc_type, exc_value)) 313 .format(self.testName, exc_type, exc_value))
313 return 314 return
314 315

eric ide

mercurial