1250 @param parent reference to the parent widget |
1248 @param parent reference to the parent widget |
1251 @type UnittestDialog |
1249 @type UnittestDialog |
1252 @param failfast flag indicating to stop at the first error |
1250 @param failfast flag indicating to stop at the first error |
1253 @type bool |
1251 @type bool |
1254 """ |
1252 """ |
1255 super(QtTestResult, self).__init__() |
1253 super().__init__() |
1256 self.parent = parent |
1254 self.parent = parent |
1257 self.failfast = failfast |
1255 self.failfast = failfast |
1258 |
1256 |
1259 def addFailure(self, test, err): |
1257 def addFailure(self, test, err): |
1260 """ |
1258 """ |
1261 Public method called if a test failed. |
1259 Public method called if a test failed. |
1262 |
1260 |
1263 @param test reference to the test object |
1261 @param test reference to the test object |
1264 @param err error traceback |
1262 @param err error traceback |
1265 """ |
1263 """ |
1266 super(QtTestResult, self).addFailure(test, err) |
1264 super().addFailure(test, err) |
1267 tracebackLines = self._exc_info_to_string(err, test) |
1265 tracebackLines = self._exc_info_to_string(err, test) |
1268 self.parent.testFailed(str(test), tracebackLines, test.id()) |
1266 self.parent.testFailed(str(test), tracebackLines, test.id()) |
1269 |
1267 |
1270 def addError(self, test, err): |
1268 def addError(self, test, err): |
1271 """ |
1269 """ |
1272 Public method called if a test errored. |
1270 Public method called if a test errored. |
1273 |
1271 |
1274 @param test reference to the test object |
1272 @param test reference to the test object |
1275 @param err error traceback |
1273 @param err error traceback |
1276 """ |
1274 """ |
1277 super(QtTestResult, self).addError(test, err) |
1275 super().addError(test, err) |
1278 tracebackLines = self._exc_info_to_string(err, test) |
1276 tracebackLines = self._exc_info_to_string(err, test) |
1279 self.parent.testErrored(str(test), tracebackLines, test.id()) |
1277 self.parent.testErrored(str(test), tracebackLines, test.id()) |
1280 |
1278 |
1281 def addSkip(self, test, reason): |
1279 def addSkip(self, test, reason): |
1282 """ |
1280 """ |
1283 Public method called if a test was skipped. |
1281 Public method called if a test was skipped. |
1284 |
1282 |
1285 @param test reference to the test object |
1283 @param test reference to the test object |
1286 @param reason reason for skipping the test (string) |
1284 @param reason reason for skipping the test (string) |
1287 """ |
1285 """ |
1288 super(QtTestResult, self).addSkip(test, reason) |
1286 super().addSkip(test, reason) |
1289 self.parent.testSkipped(str(test), reason, test.id()) |
1287 self.parent.testSkipped(str(test), reason, test.id()) |
1290 |
1288 |
1291 def addExpectedFailure(self, test, err): |
1289 def addExpectedFailure(self, test, err): |
1292 """ |
1290 """ |
1293 Public method called if a test failed expected. |
1291 Public method called if a test failed expected. |
1294 |
1292 |
1295 @param test reference to the test object |
1293 @param test reference to the test object |
1296 @param err error traceback |
1294 @param err error traceback |
1297 """ |
1295 """ |
1298 super(QtTestResult, self).addExpectedFailure(test, err) |
1296 super().addExpectedFailure(test, err) |
1299 tracebackLines = self._exc_info_to_string(err, test) |
1297 tracebackLines = self._exc_info_to_string(err, test) |
1300 self.parent.testFailedExpected(str(test), tracebackLines, test.id()) |
1298 self.parent.testFailedExpected(str(test), tracebackLines, test.id()) |
1301 |
1299 |
1302 def addUnexpectedSuccess(self, test): |
1300 def addUnexpectedSuccess(self, test): |
1303 """ |
1301 """ |
1304 Public method called if a test succeeded expectedly. |
1302 Public method called if a test succeeded expectedly. |
1305 |
1303 |
1306 @param test reference to the test object |
1304 @param test reference to the test object |
1307 """ |
1305 """ |
1308 super(QtTestResult, self).addUnexpectedSuccess(test) |
1306 super().addUnexpectedSuccess(test) |
1309 self.parent.testSucceededUnexpected(str(test), test.id()) |
1307 self.parent.testSucceededUnexpected(str(test), test.id()) |
1310 |
1308 |
1311 def startTest(self, test): |
1309 def startTest(self, test): |
1312 """ |
1310 """ |
1313 Public method called at the start of a test. |
1311 Public method called at the start of a test. |
1314 |
1312 |
1315 @param test Reference to the test object |
1313 @param test Reference to the test object |
1316 """ |
1314 """ |
1317 super(QtTestResult, self).startTest(test) |
1315 super().startTest(test) |
1318 self.parent.testStarted(str(test), test.shortDescription()) |
1316 self.parent.testStarted(str(test), test.shortDescription()) |
1319 |
1317 |
1320 def stopTest(self, test): |
1318 def stopTest(self, test): |
1321 """ |
1319 """ |
1322 Public method called at the end of a test. |
1320 Public method called at the end of a test. |
1323 |
1321 |
1324 @param test Reference to the test object |
1322 @param test Reference to the test object |
1325 """ |
1323 """ |
1326 super(QtTestResult, self).stopTest(test) |
1324 super().stopTest(test) |
1327 self.parent.testFinished() |
1325 self.parent.testFinished() |
1328 |
1326 |
1329 |
1327 |
1330 class UnittestWindow(E5MainWindow): |
1328 class UnittestWindow(E5MainWindow): |
1331 """ |
1329 """ |