码迷,mamicode.com
首页 > 其他好文 > 详细

一种想法

时间:2014-06-18 23:51:59      阅读:355      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   tar   color   

class TestCase:
    def run(self, result=None):
        if result is None:
result=self.defaultTestResult()
result.startTest(self) testMethod = getattr(self, self._testMethodName) try: try: self.setUp() except KeyboardInterrupt: raise except: result.addError(self, self._exc_info()) return ok = False n = 1 try: while n<=self.repeat or ok is False: try: testMethod() ok = True break except Exception as e: if n == self.repeat: raise self.failureException(str(e)) finally: n+=1 except self.failureException: result.addFailure(self, self._exc_info()) except KeyboardInterrupt: raise except: result.addError(self, self._exc_info()) try: self.tearDown() except KeyboardInterrupt: raise except: result.addError(self, self._exc_info()) ok = False if ok: result.addSuccess(self) finally: result.stopTest(self)

一种想法,布布扣,bubuko.com

一种想法

标签:style   class   blog   code   tar   color   

原文地址:http://www.cnblogs.com/timp/p/3789715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!