--- a/eric6/PyUnit/UnittestDialog.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/PyUnit/UnittestDialog.py Sat May 01 14:27:20 2021 +0200 @@ -12,6 +12,7 @@ import time import re import os +import contextlib from PyQt5.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot from PyQt5.QtGui import QColor @@ -71,7 +72,7 @@ @param name name of this dialog @type str """ - super(UnittestDialog, self).__init__(parent) + super().__init__(parent) if name: self.setObjectName(name) self.setupUi(self) @@ -1230,11 +1231,8 @@ event.accept() for editor in self.__editors: - try: + with contextlib.suppress(Exception): editor.close() - except Exception: # secok - # ignore all exceptions - pass class QtTestResult(unittest.TestResult): @@ -1252,7 +1250,7 @@ @param failfast flag indicating to stop at the first error @type bool """ - super(QtTestResult, self).__init__() + super().__init__() self.parent = parent self.failfast = failfast @@ -1263,7 +1261,7 @@ @param test reference to the test object @param err error traceback """ - super(QtTestResult, self).addFailure(test, err) + super().addFailure(test, err) tracebackLines = self._exc_info_to_string(err, test) self.parent.testFailed(str(test), tracebackLines, test.id()) @@ -1274,7 +1272,7 @@ @param test reference to the test object @param err error traceback """ - super(QtTestResult, self).addError(test, err) + super().addError(test, err) tracebackLines = self._exc_info_to_string(err, test) self.parent.testErrored(str(test), tracebackLines, test.id()) @@ -1285,7 +1283,7 @@ @param test reference to the test object @param reason reason for skipping the test (string) """ - super(QtTestResult, self).addSkip(test, reason) + super().addSkip(test, reason) self.parent.testSkipped(str(test), reason, test.id()) def addExpectedFailure(self, test, err): @@ -1295,7 +1293,7 @@ @param test reference to the test object @param err error traceback """ - super(QtTestResult, self).addExpectedFailure(test, err) + super().addExpectedFailure(test, err) tracebackLines = self._exc_info_to_string(err, test) self.parent.testFailedExpected(str(test), tracebackLines, test.id()) @@ -1305,7 +1303,7 @@ @param test reference to the test object """ - super(QtTestResult, self).addUnexpectedSuccess(test) + super().addUnexpectedSuccess(test) self.parent.testSucceededUnexpected(str(test), test.id()) def startTest(self, test): @@ -1314,7 +1312,7 @@ @param test Reference to the test object """ - super(QtTestResult, self).startTest(test) + super().startTest(test) self.parent.testStarted(str(test), test.shortDescription()) def stopTest(self, test): @@ -1323,7 +1321,7 @@ @param test Reference to the test object """ - super(QtTestResult, self).stopTest(test) + super().stopTest(test) self.parent.testFinished() @@ -1338,7 +1336,7 @@ @param prog filename of the program to open @param parent reference to the parent widget (QWidget) """ - super(UnittestWindow, self).__init__(parent) + super().__init__(parent) self.cw = UnittestDialog(prog, parent=self) self.cw.installEventFilter(self) size = self.cw.size()