PyUnit/UnittestDialog.py

changeset 5603
4f2dd0850803
parent 5409
c6f4a6f0d051
child 6027
d056a536670e
equal deleted inserted replaced
5602:77755a5ea30c 5603:4f2dd0850803
198 ' '.join(["*{0}".format(ext) 198 ' '.join(["*{0}".format(ext)
199 for ext in self.dbs.getExtensions('Python2')]) 199 for ext in self.dbs.getExtensions('Python2')])
200 py3Extensions = \ 200 py3Extensions = \
201 ' '.join(["*{0}".format(ext) 201 ' '.join(["*{0}".format(ext)
202 for ext in self.dbs.getExtensions('Python3')]) 202 for ext in self.dbs.getExtensions('Python3')])
203 filter = self.tr( 203 fileFilter = self.tr(
204 "Python3 Files ({1});;Python2 Files ({0});;All Files (*)")\ 204 "Python3 Files ({1});;Python2 Files ({0});;All Files (*)")\
205 .format(py2Extensions, py3Extensions) 205 .format(py2Extensions, py3Extensions)
206 else: 206 else:
207 filter = self.tr("Python Files (*.py);;All Files (*)") 207 fileFilter = self.tr("Python Files (*.py);;All Files (*)")
208 self.testsuitePicker.setFilters(filter) 208 self.testsuitePicker.setFilters(fileFilter)
209 209
210 @pyqtSlot(str) 210 @pyqtSlot(str)
211 def on_testsuitePicker_pathSelected(self, suite): 211 def on_testsuitePicker_pathSelected(self, suite):
212 """ 212 """
213 Private slot called after a test suite has been selected. 213 Private slot called after a test suite has been selected.
502 .format(self.runCount, self.timeTaken)) 502 .format(self.runCount, self.timeTaken))
503 self.progressLed.off() 503 self.progressLed.off()
504 504
505 self.unittestStopped.emit() 505 self.unittestStopped.emit()
506 506
507 def testFailed(self, test, exc, id): 507 def testFailed(self, test, exc, testId):
508 """ 508 """
509 Public method called if a test fails. 509 Public method called if a test fails.
510 510
511 @param test name of the test (string) 511 @param test name of the test (string)
512 @param exc string representation of the exception (string) 512 @param exc string representation of the exception (string)
513 @param id id of the test (string) 513 @param testId id of the test (string)
514 """ 514 """
515 self.failCount += 1 515 self.failCount += 1
516 self.progressCounterFailureCount.setText(str(self.failCount)) 516 self.progressCounterFailureCount.setText(str(self.failCount))
517 itm = QListWidgetItem(self.tr("Failure: {0}").format(test)) 517 itm = QListWidgetItem(self.tr("Failure: {0}").format(test))
518 itm.setData(Qt.UserRole, (test, exc)) 518 itm.setData(Qt.UserRole, (test, exc))
519 self.errorsListWidget.insertItem(0, itm) 519 self.errorsListWidget.insertItem(0, itm)
520 self.__failedTests.append(id) 520 self.__failedTests.append(testId)
521 521
522 def testErrored(self, test, exc, id): 522 def testErrored(self, test, exc, testId):
523 """ 523 """
524 Public method called if a test errors. 524 Public method called if a test errors.
525 525
526 @param test name of the test (string) 526 @param test name of the test (string)
527 @param exc string representation of the exception (string) 527 @param exc string representation of the exception (string)
528 @param id id of the test (string) 528 @param testId id of the test (string)
529 """ 529 """
530 self.errorCount += 1 530 self.errorCount += 1
531 self.progressCounterErrorCount.setText(str(self.errorCount)) 531 self.progressCounterErrorCount.setText(str(self.errorCount))
532 itm = QListWidgetItem(self.tr("Error: {0}").format(test)) 532 itm = QListWidgetItem(self.tr("Error: {0}").format(test))
533 itm.setData(Qt.UserRole, (test, exc)) 533 itm.setData(Qt.UserRole, (test, exc))
534 self.errorsListWidget.insertItem(0, itm) 534 self.errorsListWidget.insertItem(0, itm)
535 self.__failedTests.append(id) 535 self.__failedTests.append(testId)
536 536
537 def testSkipped(self, test, reason, id): 537 def testSkipped(self, test, reason, testId):
538 """ 538 """
539 Public method called if a test was skipped. 539 Public method called if a test was skipped.
540 540
541 @param test name of the test (string) 541 @param test name of the test (string)
542 @param reason reason for skipping the test (string) 542 @param reason reason for skipping the test (string)
543 @param id id of the test (string) 543 @param testId id of the test (string)
544 """ 544 """
545 self.skippedCount += 1 545 self.skippedCount += 1
546 self.progressCounterSkippedCount.setText(str(self.skippedCount)) 546 self.progressCounterSkippedCount.setText(str(self.skippedCount))
547 itm = QListWidgetItem(self.tr(" Skipped: {0}").format(reason)) 547 itm = QListWidgetItem(self.tr(" Skipped: {0}").format(reason))
548 itm.setForeground(Qt.blue) 548 itm.setForeground(Qt.blue)
549 self.testsListWidget.insertItem(1, itm) 549 self.testsListWidget.insertItem(1, itm)
550 550
551 def testFailedExpected(self, test, exc, id): 551 def testFailedExpected(self, test, exc, testId):
552 """ 552 """
553 Public method called if a test fails expectedly. 553 Public method called if a test fails expectedly.
554 554
555 @param test name of the test (string) 555 @param test name of the test (string)
556 @param exc string representation of the exception (string) 556 @param exc string representation of the exception (string)
557 @param id id of the test (string) 557 @param testId id of the test (string)
558 """ 558 """
559 self.expectedFailureCount += 1 559 self.expectedFailureCount += 1
560 self.progressCounterExpectedFailureCount.setText( 560 self.progressCounterExpectedFailureCount.setText(
561 str(self.expectedFailureCount)) 561 str(self.expectedFailureCount))
562 itm = QListWidgetItem(self.tr(" Expected Failure")) 562 itm = QListWidgetItem(self.tr(" Expected Failure"))
563 itm.setForeground(Qt.blue) 563 itm.setForeground(Qt.blue)
564 self.testsListWidget.insertItem(1, itm) 564 self.testsListWidget.insertItem(1, itm)
565 565
566 def testSucceededUnexpected(self, test, id): 566 def testSucceededUnexpected(self, test, testId):
567 """ 567 """
568 Public method called if a test succeeds unexpectedly. 568 Public method called if a test succeeds unexpectedly.
569 569
570 @param test name of the test (string) 570 @param test name of the test (string)
571 @param id id of the test (string) 571 @param testId id of the test (string)
572 """ 572 """
573 self.unexpectedSuccessCount += 1 573 self.unexpectedSuccessCount += 1
574 self.progressCounterUnexpectedSuccessCount.setText( 574 self.progressCounterUnexpectedSuccessCount.setText(
575 str(self.unexpectedSuccessCount)) 575 str(self.unexpectedSuccessCount))
576 itm = QListWidgetItem(self.tr(" Unexpected Success")) 576 itm = QListWidgetItem(self.tr(" Unexpected Success"))

eric ide

mercurial