653 """ |
655 """ |
654 Constructor |
656 Constructor |
655 |
657 |
656 @param parent The parent widget. |
658 @param parent The parent widget. |
657 """ |
659 """ |
658 super().__init__() |
660 super(QtTestResult, self).__init__() |
659 self.parent = parent |
661 self.parent = parent |
660 |
662 |
661 def addFailure(self, test, err): |
663 def addFailure(self, test, err): |
662 """ |
664 """ |
663 Method called if a test failed. |
665 Method called if a test failed. |
664 |
666 |
665 @param test reference to the test object |
667 @param test reference to the test object |
666 @param err error traceback |
668 @param err error traceback |
667 """ |
669 """ |
668 super().addFailure(test, err) |
670 super(QtTestResult, self).addFailure(test, err) |
669 tracebackLines = self._exc_info_to_string(err, test) |
671 tracebackLines = self._exc_info_to_string(err, test) |
670 self.parent.testFailed(str(test), tracebackLines, test.id()) |
672 self.parent.testFailed(str(test), tracebackLines, test.id()) |
671 |
673 |
672 def addError(self, test, err): |
674 def addError(self, test, err): |
673 """ |
675 """ |
674 Method called if a test errored. |
676 Method called if a test errored. |
675 |
677 |
676 @param test reference to the test object |
678 @param test reference to the test object |
677 @param err error traceback |
679 @param err error traceback |
678 """ |
680 """ |
679 super().addError(test, err) |
681 super(QtTestResult, self).addError(test, err) |
680 tracebackLines = self._exc_info_to_string(err, test) |
682 tracebackLines = self._exc_info_to_string(err, test) |
681 self.parent.testErrored(str(test), tracebackLines, test.id()) |
683 self.parent.testErrored(str(test), tracebackLines, test.id()) |
682 |
684 |
683 def addSkip(self, test, reason): |
685 def addSkip(self, test, reason): |
684 """ |
686 """ |
685 Method called if a test was skipped. |
687 Method called if a test was skipped. |
686 |
688 |
687 @param test reference to the test object |
689 @param test reference to the test object |
688 @param reason reason for skipping the test (string) |
690 @param reason reason for skipping the test (string) |
689 """ |
691 """ |
690 super().addSkip(test, reason) |
692 super(QtTestResult, self).addSkip(test, reason) |
691 self.parent.testSkipped(str(test), reason, test.id()) |
693 self.parent.testSkipped(str(test), reason, test.id()) |
692 |
694 |
693 def addExpectedFailure(self, test, err): |
695 def addExpectedFailure(self, test, err): |
694 """ |
696 """ |
695 Method called if a test failed expected. |
697 Method called if a test failed expected. |
696 |
698 |
697 @param test reference to the test object |
699 @param test reference to the test object |
698 @param err error traceback |
700 @param err error traceback |
699 """ |
701 """ |
700 super().addExpectedFailure(test, err) |
702 super(QtTestResult, self).addExpectedFailure(test, err) |
701 tracebackLines = self._exc_info_to_string(err, test) |
703 tracebackLines = self._exc_info_to_string(err, test) |
702 self.parent.testFailedExpected(str(test), tracebackLines, test.id()) |
704 self.parent.testFailedExpected(str(test), tracebackLines, test.id()) |
703 |
705 |
704 def addUnexpectedSuccess(self, test): |
706 def addUnexpectedSuccess(self, test): |
705 """ |
707 """ |
706 Method called if a test succeeded expectedly. |
708 Method called if a test succeeded expectedly. |
707 |
709 |
708 @param test reference to the test object |
710 @param test reference to the test object |
709 """ |
711 """ |
710 super().addUnexpectedSuccess(test) |
712 super(QtTestResult, self).addUnexpectedSuccess(test) |
711 self.parent.testSucceededUnexpected(str(test), test.id()) |
713 self.parent.testSucceededUnexpected(str(test), test.id()) |
712 |
714 |
713 def startTest(self, test): |
715 def startTest(self, test): |
714 """ |
716 """ |
715 Method called at the start of a test. |
717 Method called at the start of a test. |
716 |
718 |
717 @param test Reference to the test object |
719 @param test Reference to the test object |
718 """ |
720 """ |
719 super().startTest(test) |
721 super(QtTestResult, self).startTest(test) |
720 self.parent.testStarted(str(test), test.shortDescription()) |
722 self.parent.testStarted(str(test), test.shortDescription()) |
721 |
723 |
722 def stopTest(self, test): |
724 def stopTest(self, test): |
723 """ |
725 """ |
724 Method called at the end of a test. |
726 Method called at the end of a test. |
725 |
727 |
726 @param test Reference to the test object |
728 @param test Reference to the test object |
727 """ |
729 """ |
728 super().stopTest(test) |
730 super(QtTestResult, self).stopTest(test) |
729 self.parent.testFinished() |
731 self.parent.testFinished() |
730 |
732 |
731 |
733 |
732 class UnittestWindow(E5MainWindow): |
734 class UnittestWindow(E5MainWindow): |
733 """ |
735 """ |