tests/run-tests.py
changeset 21448 f2dbbcacc763
parent 21447 f8c5b8a288c5
child 21449 aedf18bcde11
equal deleted inserted replaced
21447:f8c5b8a288c5 21448:f2dbbcacc763
  1362                 return self.name
  1362                 return self.name
  1363 
  1363 
  1364             # Need to stash away the TestResult since we do custom things
  1364             # Need to stash away the TestResult since we do custom things
  1365             # with it.
  1365             # with it.
  1366             def run(self, result):
  1366             def run(self, result):
       
  1367                 result.startTest(self)
  1367                 try:
  1368                 try:
  1368                     t.setUp()
  1369                     try:
  1369                 except (KeyboardInterrupt, SystemExit):
  1370                         t.setUp()
  1370                     raise
  1371                     except (KeyboardInterrupt, SystemExit):
  1371                 except Exception:
  1372                         raise
  1372                     result.addError(self, sys.exc_info())
  1373                     except Exception:
  1373                     return
  1374                         result.addError(self, sys.exc_info())
  1374 
  1375                         return
  1375                 success = False
  1376 
  1376                 try:
       
  1377                     self.runTest()
       
  1378                 except KeyboardInterrupt:
       
  1379                     raise
       
  1380                 except SkipTest, e:
       
  1381                     result.addSkip(self, str(e))
       
  1382                 except IgnoreTest, e:
       
  1383                     result.addIgnore(self, str(e))
       
  1384                 except WarnTest, e:
       
  1385                     result.addWarn(self, str(e))
       
  1386                 except self.failureException:
       
  1387                     result.addFailure(self, sys.exc_info())
       
  1388                 except Exception:
       
  1389                     result.addError(self, sys.exc_info())
       
  1390                 else:
       
  1391                     success = True
       
  1392 
       
  1393                 try:
       
  1394                     t.tearDown()
       
  1395                 except (KeyboardInterrupt, SystemExit):
       
  1396                     raise
       
  1397                 except Exception:
       
  1398                     result.addError(self, sys.exc_info())
       
  1399                     success = False
  1377                     success = False
  1400 
  1378                     try:
  1401                 if success:
  1379                         self.runTest()
  1402                     result.addSuccess(self)
  1380                     except KeyboardInterrupt:
       
  1381                         raise
       
  1382                     except SkipTest, e:
       
  1383                         result.addSkip(self, str(e))
       
  1384                     except IgnoreTest, e:
       
  1385                         result.addIgnore(self, str(e))
       
  1386                     except WarnTest, e:
       
  1387                         result.addWarn(self, str(e))
       
  1388                     except self.failureException:
       
  1389                         result.addFailure(self, sys.exc_info())
       
  1390                     except Exception:
       
  1391                         result.addError(self, sys.exc_info())
       
  1392                     else:
       
  1393                         success = True
       
  1394 
       
  1395                     try:
       
  1396                         t.tearDown()
       
  1397                     except (KeyboardInterrupt, SystemExit):
       
  1398                         raise
       
  1399                     except Exception:
       
  1400                         result.addError(self, sys.exc_info())
       
  1401                         success = False
       
  1402 
       
  1403                     if success:
       
  1404                         result.addSuccess(self)
       
  1405                 finally:
       
  1406                     result.stopTest(self)
  1403 
  1407 
  1404             def runTest(self):
  1408             def runTest(self):
  1405                 code, tname, msg = t.run()
  1409                 code, tname, msg = t.run()
  1406 
  1410 
  1407                 # All non-success conditions should be exceptions and should
  1411                 # All non-success conditions should be exceptions and should