Example #1
0
    def _handleClassSetUp(self, test, result):
        """
        Pass the current result at TestCase SetupClass
        """

        raise Exception('setUpClass debug')

        previousClass = getattr(result, '_previousTestClass', None)
        currentClass = test.__class__
        if currentClass == previousClass:
            return
        if result._moduleSetUpFailed:
            return
        if getattr(currentClass, "__unittest_skip__", False):
            return

        try:
            currentClass._classSetupFailed = False
        except TypeError:
            # test may actually be a function
            # so its class will be a builtin-type
            pass

        setUpClass = getattr(currentClass, 'setUpClass', None)
        if setUpClass is not None:
            try:
                setUpClass(result)
            except Exception, e:
                if isinstance(result, _DebugResult):
                    raise
                currentClass._classSetupFailed = True
                className = util.strclass(currentClass)
                errorName = 'setUpClass (%s)' % className
                self._addClassOrModuleLevelException(result, e, errorName)
Example #2
0
    def _handleClassSetUp(self, test, result):
        previousClass = getattr(result, '_previousTestClass', None)
        currentClass = test.__class__
        if currentClass == previousClass:
            return
        if result._moduleSetUpFailed:
            return
        if getattr(currentClass, "__unittest_skip__", False):
            return

        try:
            currentClass._classSetupFailed = False
        except TypeError:
            # test may actually be a function
            # so its class will be a builtin-type
            pass

        setUpClass = getattr(currentClass, 'setUpClass', None)
        if setUpClass is not None:
            try:
                setUpClass()
            except Exception:
                e = sys.exc_info()[1]
                if isinstance(result, _DebugResult):
                    raise
                currentClass._classSetupFailed = True
                className = util.strclass(currentClass)
                errorName = 'setUpClass (%s)' % className
                self._addClassOrModuleLevelException(result, e, errorName)
Example #3
0
 def __repr__(self):
     return "<%s run=%i errors=%i failures=%i>" % (
         util.strclass(self.__class__),
         self.testsRun,
         len(self.errors),
         len(self.failures),
     )
Example #4
0
    def _tearDownPreviousClass(self, test, result):
        previousClass = getattr(result, '_previousTestClass', None)
        currentClass = test.__class__
        if currentClass == previousClass:
            return
        if getattr(previousClass, '_classSetupFailed', False):
            return
        if getattr(result, '_moduleSetUpFailed', False):
            return
        if getattr(previousClass, "__unittest_skip__", False):
            return

        tearDownClass = getattr(previousClass, 'tearDownClass', None)
        if tearDownClass is not None:
            try:
                tearDownClass()
            except Exception as e:
                if isinstance(result, _DebugResult):
                    raise
                className = util.strclass(previousClass)
                errorName = 'tearDownClass (%s)' % className
                self._addClassOrModuleLevelException(result, e, errorName)
Example #5
0
 def __repr__(self):
     return "<{0!s} testMethod={1!s}>".format(strclass(self.__class__), self._testMethodName)
Example #6
0
 def __str__(self):
     return "%s (%s)" % (self._testMethodName, strclass(self.__class__))
Example #7
0
 def __repr__(self):
     return "<%s testMethod=%s>" % \
            (strclass(self.__class__), self._testMethodName)
Example #8
0
 def shortDescription(self):
     return strclass(self.__class__) + '.' + self._testMethodName
Example #9
0
 def _addClassSetUpError(self, result, klass):
     className = util.strclass(klass)
     error = _ErrorHolder('classSetUp (%s)' % className)
     result.addError(error, sys.exc_info())
Example #10
0
 def __repr__(self):
     return "<{0!s} testFunc={1!s}>".format(strclass(self.__class__),
                                            self._testFunc)
Example #11
0
 def __str__(self):
     return "{0!s} ({1!s})".format(self._testMethodName,
                                   strclass(self.__class__))
Example #12
0
 def shortDescription(self):
     return strclass(self.__class__) + '.' + self._testMethodName
Example #13
0
 def __repr__(self):
     return '<%s tests=%s>' % (util.strclass(self.__class__), list(self))
Example #14
0
 def __str__(self):
     return "{0!s} ({1!s})".format(self._testMethodName, strclass(self.__class__))
Example #15
0
 def id(self):
     return "{0!s}.{1!s}".format(strclass(self.__class__), self._testMethodName)
Example #16
0
 def __repr__(self):
     return "<{0!s} testFunc={1!s}>".format(strclass(self.__class__),
                                  self._testFunc)
Example #17
0
 def __str__(self):
     return "{0!s} ({1!s})".format(strclass(self.__class__),
                         self._testFunc.__name__)
Example #18
0
 def __repr__(self):
     return "<{0!s} tests={1!s}>".format(util.strclass(self.__class__), list(self))
Example #19
0
 def __repr__(self):
     return "<%s tests=%s>" % (util.strclass(self.__class__), list(self))
Example #20
0
 def __repr__(self):
     return "<{0!s} run={1:d} errors={2:d} failures={3:d}>".format(util.strclass(self.__class__), self.testsRun, len(self.errors),
             len(self.failures))
Example #21
0
 def __str__(self):
     return "{0!s} ({1!s})".format(strclass(self.__class__),
                                   self._testFunc.__name__)
Example #22
0
 def __str__(self):
     return "%s (%s)" % (strclass(self.__class__),
                         self._testFunc.__name__)
Example #23
0
 def id(self):
     return "{0!s}.{1!s}".format(strclass(self.__class__),
                                 self._testMethodName)
Example #24
0
 def __repr__(self):
     return "<%s testFunc=%s>" % (strclass(self.__class__),
                                  self._testFunc)
Example #25
0
 def __repr__(self):
     return "<{0!s} testMethod={1!s}>".format(strclass(self.__class__),
                                              self._testMethodName)
Example #26
0
 def id(self):
     return "%s.%s" % (strclass(self.__class__), self._testMethodName)
Example #27
0
 def __repr__(self):
     return "<%s run=%i errors=%i failures=%i>" % \
            (util.strclass(self.__class__), self.testsRun, len(self.errors),
             len(self.failures))
Example #28
0
 def _addClassTearDownError(self, result):
     className = util.strclass(result._previousTestClass)
     error = _ErrorHolder('classTearDown (%s)' % className)
     result.addError(error, sys.exc_info())