diff -r ef170cde761b -r 73ef1edca602 eric6/PyUnit/UnittestDialog.py --- a/eric6/PyUnit/UnittestDialog.py Sun May 23 18:39:22 2021 +0200 +++ b/eric6/PyUnit/UnittestDialog.py Sun May 23 18:45:54 2021 +0200 @@ -578,20 +578,18 @@ @rtype list of str """ selectedTests = [] - if parent is None: + itemsList = [ # top level - itemsList = [ - self.discoveryList.topLevelItem(index) - for index in range(self.discoveryList.topLevelItemCount()) - ] - else: - itemsList = [ - parent.child(index) - for index in range(parent.childCount()) - ] + self.discoveryList.topLevelItem(index) + for index in range(self.discoveryList.topLevelItemCount()) + ] if parent is None else [ + parent.child(index) + for index in range(parent.childCount()) + ] for itm in itemsList: - if (itm.checkState(0) == Qt.CheckState.Checked and + if ( + itm.checkState(0) == Qt.CheckState.Checked and itm.childCount() == 0 ): selectedTests.append(