How to use the junitparser.junitparser.FloatAttr function in junitparser

To help you get started, we’ve selected a few junitparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gastlygem / junitparser / junitparser / junitparser.py View on Github external
Attributes:
        name: test suite name
        hostname: name of the test machine
        time: time concumed by the test suite
        timestamp: when the test was run
        tests: total number of tests
        failures: number of failed tests
        errors: number of cases with errors
        skipped: number of skipped cases
    """

    _tag = "testsuite"
    name = Attr()
    hostname = Attr()
    time = FloatAttr()
    timestamp = Attr()
    tests = IntAttr()
    failures = IntAttr()
    errors = IntAttr()
    skipped = IntAttr()

    def __init__(self, name=None):
        super(TestSuite, self).__init__(self._tag)
        self.name = name
        self.filepath = None

    def __iter__(self):
        return super(TestSuite, self).iterchildren(TestCase)

    def __len__(self):
        return len(list(self.__iter__()))
github gastlygem / junitparser / junitparser / junitparser.py View on Github external
def __set__(self, instance, value):
        if not (isinstance(value, float) or isinstance(value, int)):
            raise TypeError("Expected float value.")
        super(FloatAttr, self).__set__(instance, value)
github gastlygem / junitparser / junitparser / junitparser.py View on Github external
def __get__(self, instance, cls):
        result = super(FloatAttr, self).__get__(instance, cls)
        if result is None and (
            isinstance(instance, JUnitXml) or isinstance(instance, TestSuite)
        ):
            instance.update_statistics()
            result = super(FloatAttr, self).__get__(instance, cls)
        return float(result) if result else None
github gastlygem / junitparser / junitparser / junitparser.py View on Github external
Attributes:
        name: case name
        classname: the parent class of the case
        time: how much time is consumed by the test

    Properties:
        result: Failure, Skipped, or Error
        system_out: stdout
        system_err: stderr
    """

    _tag = "testcase"
    name = Attr()
    classname = Attr()
    time = FloatAttr()

    def __init__(self, name=None):
        super(TestCase, self).__init__(self._tag)
        self.name = name

    def __hash__(self):
        return super(TestCase, self).__hash__()

    def __eq__(self, other):
        # TODO: May not work correctly if unreliable hash method is used.
        return hash(self) == hash(other)

    @property
    def result(self):
        """One of the Failure, Skipped, or Error objects."""
        results = []