579 @rtype list of str |
579 @rtype list of str |
580 """ |
580 """ |
581 selectedTests = [] |
581 selectedTests = [] |
582 if parent is None: |
582 if parent is None: |
583 # top level |
583 # top level |
584 for index in range(self.discoveryList.topLevelItemCount()): |
584 itemsList = [ |
585 itm = self.discoveryList.topLevelItem(index) |
585 self.discoveryList.topLevelItem(index) |
586 if itm.checkState(0) == Qt.CheckState.Checked: |
586 for index in range(self.discoveryList.topLevelItemCount()) |
587 selectedTests.append( |
587 ] |
588 itm.data(0, UnittestDialog.TestCaseNameRole)) |
|
589 # ignore children because they are included implicitly |
|
590 elif itm.childCount(): |
|
591 # recursively check children |
|
592 selectedTests.extend(self.__selectedTestCases(itm)) |
|
593 |
|
594 else: |
588 else: |
595 # parent item with children |
589 itemsList = [ |
596 for index in range(parent.childCount()): |
590 parent.child(index) |
597 itm = parent.child(index) |
591 for index in range(parent.childCount()) |
598 if itm.checkState(0) == Qt.CheckState.Checked: |
592 ] |
599 selectedTests.append( |
593 |
600 itm.data(0, UnittestDialog.TestCaseNameRole)) |
594 for itm in itemsList: |
601 # ignore children because they are included implicitly |
595 if (itm.checkState(0) == Qt.CheckState.Checked and |
602 elif itm.childCount(): |
596 itm.childCount() == 0 |
603 # recursively check children |
597 ): |
604 selectedTests.extend(self.__selectedTestCases(itm)) |
598 selectedTests.append( |
|
599 itm.data(0, UnittestDialog.TestCaseNameRole)) |
|
600 if itm.childCount(): |
|
601 # recursively check children |
|
602 selectedTests.extend(self.__selectedTestCases(itm)) |
605 |
603 |
606 return selectedTests |
604 return selectedTests |
607 |
605 |
608 def __UTDiscovered(self, testCases, exc_type, exc_value): |
606 def __UTDiscovered(self, testCases, exc_type, exc_value): |
609 """ |
607 """ |
880 cover = None |
878 cover = None |
881 |
879 |
882 self.testResult = QtTestResult( |
880 self.testResult = QtTestResult( |
883 self, self.failfastCheckBox.isChecked()) |
881 self, self.failfastCheckBox.isChecked()) |
884 self.totalTests = test.countTestCases() |
882 self.totalTests = test.countTestCases() |
885 self.__failedTests = [] |
883 if self.totalTests == 0: |
886 self.__setRunningMode() |
884 E5MessageBox.warning( |
887 if cover: |
885 self, |
888 cover.start() |
886 self.tr("Unittest"), |
889 test.run(self.testResult) |
887 self.tr("""No unittest were found. Aborting...""")) |
890 if cover: |
888 else: |
891 cover.stop() |
889 self.__failedTests = [] |
892 cover.save() |
890 self.__setRunningMode() |
893 self.__setStoppedMode() |
891 if cover: |
894 sys.path = self.savedSysPath |
892 cover.start() |
|
893 test.run(self.testResult) |
|
894 if cover: |
|
895 cover.stop() |
|
896 cover.save() |
|
897 self.__setStoppedMode() |
|
898 sys.path = self.savedSysPath |
895 |
899 |
896 def __UTPrepared(self, nrTests, exc_type, exc_value): |
900 def __UTPrepared(self, nrTests, exc_type, exc_value): |
897 """ |
901 """ |
898 Private slot to handle the utPrepared signal. |
902 Private slot to handle the utPrepared signal. |
899 |
903 |