PyUnit/UnittestDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
254 if self.running: 254 if self.running:
255 return 255 return
256 256
257 prog = self.testsuiteComboBox.currentText() 257 prog = self.testsuiteComboBox.currentText()
258 if not prog: 258 if not prog:
259 E5MessageBox.critical(self, 259 E5MessageBox.critical(
260 self.trUtf8("Unittest"), 260 self,
261 self.trUtf8("You must enter a test suite file.")) 261 self.trUtf8("Unittest"),
262 self.trUtf8("You must enter a test suite file."))
262 return 263 return
263 264
264 # prepend the selected file to the testsuite combobox 265 # prepend the selected file to the testsuite combobox
265 self.insertProg(prog) 266 self.insertProg(prog)
266 self.sbLabel.setText(self.trUtf8("Preparing Testsuite")) 267 self.sbLabel.setText(self.trUtf8("Preparing Testsuite"))
294 if failedOnly and self.__failedTests: 295 if failedOnly and self.__failedTests:
295 failed = [t.split(".", 1)[1] for t in self.__failedTests] 296 failed = [t.split(".", 1)[1] for t in self.__failedTests]
296 else: 297 else:
297 failed = [] 298 failed = []
298 self.__failedTests = [] 299 self.__failedTests = []
299 self.dbs.remoteUTPrepare(prog, self.testName, testFunctionName, 300 self.dbs.remoteUTPrepare(
300 failed, 301 prog, self.testName, testFunctionName, failed,
301 self.coverageCheckBox.isChecked(), mainScript, 302 self.coverageCheckBox.isChecked(), mainScript,
302 self.coverageEraseCheckBox.isChecked(), clientType=clientType) 303 self.coverageEraseCheckBox.isChecked(), clientType=clientType)
303 else: 304 else:
304 # we are running as an application or in local mode 305 # we are running as an application or in local mode
305 sys.path = [os.path.dirname(os.path.abspath(prog))] + \ 306 sys.path = [os.path.dirname(os.path.abspath(prog))] + \
328 except AttributeError: 329 except AttributeError:
329 test = unittest.defaultTestLoader.loadTestsFromModule( 330 test = unittest.defaultTestLoader.loadTestsFromModule(
330 module) 331 module)
331 except: 332 except:
332 exc_type, exc_value, exc_tb = sys.exc_info() 333 exc_type, exc_value, exc_tb = sys.exc_info()
333 E5MessageBox.critical(self, 334 E5MessageBox.critical(
334 self.trUtf8("Unittest"), 335 self,
335 self.trUtf8( 336 self.trUtf8("Unittest"),
336 "<p>Unable to run test <b>{0}</b>.<br>" 337 self.trUtf8(
337 "{1}<br>{2}</p>") 338 "<p>Unable to run test <b>{0}</b>.<br>"
338 .format(self.testName, str(exc_type), 339 "{1}<br>{2}</p>")
339 str(exc_value))) 340 .format(self.testName, str(exc_type),
341 str(exc_value)))
340 return 342 return
341 343
342 # now set up the coverage stuff 344 # now set up the coverage stuff
343 if self.coverageCheckBox.isChecked(): 345 if self.coverageCheckBox.isChecked():
344 if self.dbs: 346 if self.dbs:
386 @param nrTests number of tests contained in the test suite (integer) 388 @param nrTests number of tests contained in the test suite (integer)
387 @param exc_type type of exception occured during preparation (string) 389 @param exc_type type of exception occured during preparation (string)
388 @param exc_value value of exception occured during preparation (string) 390 @param exc_value value of exception occured during preparation (string)
389 """ 391 """
390 if nrTests == 0: 392 if nrTests == 0:
391 E5MessageBox.critical(self, 393 E5MessageBox.critical(
392 self.trUtf8("Unittest"), 394 self,
393 self.trUtf8( 395 self.trUtf8("Unittest"),
394 "<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") 396 self.trUtf8(
395 .format(self.testName, exc_type, exc_value)) 397 "<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>")
398 .format(self.testName, exc_type, exc_value))
396 return 399 return
397 400
398 self.totalTests = nrTests 401 self.totalTests = nrTests
399 self.__setRunningMode() 402 self.__setRunningMode()
400 self.dbs.remoteUTRun() 403 self.dbs.remoteUTRun()

eric ide

mercurial