Esempio n. 1
0
        from common import exc_info_to_string
        from test_info import TestInfo
        return exc_info_to_string(self.exc_info, TestInfo(self.test))

    def is_skip(self):
        """
        Does the error signify a skip?

        Normally done by checking that exception_type derives from
        SkipTestException, but that can't be done after fields pickling.
        """
        return _should_skip(self.exc_info[0])

    def exception_type(self):
        t = self.exc_info[0]
        try:
            return t.__module__ + "." + t.__name__
        except AttributeError:
            return str(t)

    def exception_value(self):
        return str(self.exc_info[1])

    def traceback(self):
        return self.exc_info[2]


from testoob.utils import add_fields_pickling

add_fields_pickling(ErrInfo)
Esempio n. 2
0
    def failure_exception_type(self):  # TODO: do we need this?
        return self.fixture.failureException

    def id(self):  # TODO: do we need this?
        return self.fixture.id()

    def short_description(self):  # TODO: do we need this?
        return self.fixture.shortDescription()

    def __str__(self):
        return str(self.fixture)

    # should be usable as dictionary keys, so define __hash__ and __cmp__
    def __unique_string_repr(self):
        return "%s - %s" % (hash(self), str(self))

    def __cmp__(self, other):
        try:
            return cmp(self.fixture, other.fixture)
        except AttributeError:
            return cmp(self.__unique_string_repr(),
                       other.__unique_string_repr())

    def __hash__(self):
        return hash(self.fixture)


from testoob.utils import add_fields_pickling
add_fields_pickling(TestInfo)
Esempio n. 3
0
    def funcinfo(self):
        return (self.funcname(), self.docstring(), self.extrainfo())

    def failure_exception_type(self): # TODO: do we need this?
        return self.fixture.failureException

    def id(self): # TODO: do we need this?
        return self.fixture.id()

    def short_description(self): # TODO: do we need this?
        return self.fixture.shortDescription()

    def __str__(self):
        return str(self.fixture)

    # should be usable as dictionary keys, so define __hash__ and __cmp__
    def __unique_string_repr(self):
        return "%s - %s" % (hash(self), str(self))

    def __cmp__(self, other):
        try:
            return cmp(self.fixture, other.fixture)
        except AttributeError:
            return cmp(self.__unique_string_repr(), other.__unique_string_repr())

    def __hash__(self):
        return hash(self.fixture)

from testoob.utils import add_fields_pickling
add_fields_pickling(TestInfo)
Esempio n. 4
0
    def __str__(self):
        from common import exc_info_to_string
        from test_info import TestInfo
        return exc_info_to_string(self.exc_info, TestInfo(self.test))

    def is_skip(self):
        """
        Does the error signify a skip?

        Normally done by checking that exception_type derives from
        SkipTestException, but that can't be done after fields pickling.
        """
        return _should_skip(self.exc_info[0])

    def exception_type(self):
        t = self.exc_info[0]
        try:
            return t.__module__ + "." + t.__name__
        except AttributeError:
            return str(t)

    def exception_value(self):
        return str(self.exc_info[1])

    def traceback(self):
        return self.exc_info[2]

from testoob.utils import add_fields_pickling
add_fields_pickling(ErrInfo)