eric6/PyUnit/UnittestDialog.py

changeset 8218
7c09585bd960
parent 8149
3fefc0c430f2
child 8240
93b8a353c4bf
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
69 @param parent parent widget of this dialog 69 @param parent parent widget of this dialog
70 @type QWidget 70 @type QWidget
71 @param name name of this dialog 71 @param name name of this dialog
72 @type str 72 @type str
73 """ 73 """
74 super(UnittestDialog, self).__init__(parent) 74 super().__init__(parent)
75 if name: 75 if name:
76 self.setObjectName(name) 76 self.setObjectName(name)
77 self.setupUi(self) 77 self.setupUi(self)
78 78
79 self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode) 79 self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode)
1250 @param parent reference to the parent widget 1250 @param parent reference to the parent widget
1251 @type UnittestDialog 1251 @type UnittestDialog
1252 @param failfast flag indicating to stop at the first error 1252 @param failfast flag indicating to stop at the first error
1253 @type bool 1253 @type bool
1254 """ 1254 """
1255 super(QtTestResult, self).__init__() 1255 super().__init__()
1256 self.parent = parent 1256 self.parent = parent
1257 self.failfast = failfast 1257 self.failfast = failfast
1258 1258
1259 def addFailure(self, test, err): 1259 def addFailure(self, test, err):
1260 """ 1260 """
1261 Public method called if a test failed. 1261 Public method called if a test failed.
1262 1262
1263 @param test reference to the test object 1263 @param test reference to the test object
1264 @param err error traceback 1264 @param err error traceback
1265 """ 1265 """
1266 super(QtTestResult, self).addFailure(test, err) 1266 super().addFailure(test, err)
1267 tracebackLines = self._exc_info_to_string(err, test) 1267 tracebackLines = self._exc_info_to_string(err, test)
1268 self.parent.testFailed(str(test), tracebackLines, test.id()) 1268 self.parent.testFailed(str(test), tracebackLines, test.id())
1269 1269
1270 def addError(self, test, err): 1270 def addError(self, test, err):
1271 """ 1271 """
1272 Public method called if a test errored. 1272 Public method called if a test errored.
1273 1273
1274 @param test reference to the test object 1274 @param test reference to the test object
1275 @param err error traceback 1275 @param err error traceback
1276 """ 1276 """
1277 super(QtTestResult, self).addError(test, err) 1277 super().addError(test, err)
1278 tracebackLines = self._exc_info_to_string(err, test) 1278 tracebackLines = self._exc_info_to_string(err, test)
1279 self.parent.testErrored(str(test), tracebackLines, test.id()) 1279 self.parent.testErrored(str(test), tracebackLines, test.id())
1280 1280
1281 def addSkip(self, test, reason): 1281 def addSkip(self, test, reason):
1282 """ 1282 """
1283 Public method called if a test was skipped. 1283 Public method called if a test was skipped.
1284 1284
1285 @param test reference to the test object 1285 @param test reference to the test object
1286 @param reason reason for skipping the test (string) 1286 @param reason reason for skipping the test (string)
1287 """ 1287 """
1288 super(QtTestResult, self).addSkip(test, reason) 1288 super().addSkip(test, reason)
1289 self.parent.testSkipped(str(test), reason, test.id()) 1289 self.parent.testSkipped(str(test), reason, test.id())
1290 1290
1291 def addExpectedFailure(self, test, err): 1291 def addExpectedFailure(self, test, err):
1292 """ 1292 """
1293 Public method called if a test failed expected. 1293 Public method called if a test failed expected.
1294 1294
1295 @param test reference to the test object 1295 @param test reference to the test object
1296 @param err error traceback 1296 @param err error traceback
1297 """ 1297 """
1298 super(QtTestResult, self).addExpectedFailure(test, err) 1298 super().addExpectedFailure(test, err)
1299 tracebackLines = self._exc_info_to_string(err, test) 1299 tracebackLines = self._exc_info_to_string(err, test)
1300 self.parent.testFailedExpected(str(test), tracebackLines, test.id()) 1300 self.parent.testFailedExpected(str(test), tracebackLines, test.id())
1301 1301
1302 def addUnexpectedSuccess(self, test): 1302 def addUnexpectedSuccess(self, test):
1303 """ 1303 """
1304 Public method called if a test succeeded expectedly. 1304 Public method called if a test succeeded expectedly.
1305 1305
1306 @param test reference to the test object 1306 @param test reference to the test object
1307 """ 1307 """
1308 super(QtTestResult, self).addUnexpectedSuccess(test) 1308 super().addUnexpectedSuccess(test)
1309 self.parent.testSucceededUnexpected(str(test), test.id()) 1309 self.parent.testSucceededUnexpected(str(test), test.id())
1310 1310
1311 def startTest(self, test): 1311 def startTest(self, test):
1312 """ 1312 """
1313 Public method called at the start of a test. 1313 Public method called at the start of a test.
1314 1314
1315 @param test Reference to the test object 1315 @param test Reference to the test object
1316 """ 1316 """
1317 super(QtTestResult, self).startTest(test) 1317 super().startTest(test)
1318 self.parent.testStarted(str(test), test.shortDescription()) 1318 self.parent.testStarted(str(test), test.shortDescription())
1319 1319
1320 def stopTest(self, test): 1320 def stopTest(self, test):
1321 """ 1321 """
1322 Public method called at the end of a test. 1322 Public method called at the end of a test.
1323 1323
1324 @param test Reference to the test object 1324 @param test Reference to the test object
1325 """ 1325 """
1326 super(QtTestResult, self).stopTest(test) 1326 super().stopTest(test)
1327 self.parent.testFinished() 1327 self.parent.testFinished()
1328 1328
1329 1329
1330 class UnittestWindow(E5MainWindow): 1330 class UnittestWindow(E5MainWindow):
1331 """ 1331 """
1336 Constructor 1336 Constructor
1337 1337
1338 @param prog filename of the program to open 1338 @param prog filename of the program to open
1339 @param parent reference to the parent widget (QWidget) 1339 @param parent reference to the parent widget (QWidget)
1340 """ 1340 """
1341 super(UnittestWindow, self).__init__(parent) 1341 super().__init__(parent)
1342 self.cw = UnittestDialog(prog, parent=self) 1342 self.cw = UnittestDialog(prog, parent=self)
1343 self.cw.installEventFilter(self) 1343 self.cw.installEventFilter(self)
1344 size = self.cw.size() 1344 size = self.cw.size()
1345 self.setCentralWidget(self.cw) 1345 self.setCentralWidget(self.cw)
1346 self.resize(size) 1346 self.resize(size)

eric ide

mercurial