Example #1
0
 def _update_svg(self, text, name):
     dom = xml(self.svg_data)
     text_fields = dom.findall(".//{http://www.w3.org/2000/svg}text")
     label = '{http://www.inkscape.org/namespaces/inkscape}label'
     for text_field in text_fields:
         if (text_field.get(label) == "#" + name) or \
                 (text_field.get("id") == name):
             span = text_field[0]
             span.text = text
     self.svg_data = xml_to_string(dom)
     self.window.queue_draw()
Example #2
0
 def result_summary(self):
     e = E('testsuite', {
         "name": "slash-suite",
         "hostname": socket.getfqdn(),
         "timestamp": self._start_time.isoformat().rsplit(".", 1)[0],
         "time": "0",
         "tests": str(context.session.results.get_num_results()),
         "errors": str(context.session.results.get_num_errors()),
         "failures": str(context.session.results.get_num_failures()),
         "skipped": str(context.session.results.get_num_skipped()),
     })
     for element in self._get_xunit_elements_list():
         e.append(element)
     with open(slash_config.root.plugin_config.xunit.filename, "wb") as outfile:
         outfile.write(xml_to_string(e))
Example #3
0
 def result_summary(self):
     e = E('testsuite', {
         "name": "slash-suite",
         "hostname": socket.getfqdn(),
         "timestamp": self._start_time.isoformat().rsplit(".", 1)[0],
         "time": "0",
         "tests": str(context.session.results.get_num_results()),
         "errors": str(context.session.results.get_num_errors()),
         "failures": str(context.session.results.get_num_failures()),
         "skipped": str(context.session.results.get_num_skipped()),
     })
     for element in self._get_xunit_elements_list():
         e.append(element)
     with open(slash_config.root.plugin_config.xunit.filename, "wb") as outfile:
         outfile.write(xml_to_string(e))
Example #4
0
    def session_end(self):

        if config.root.parallel.worker_id is not None:
            return

        suite_time = sum([
            result.get_duration()
            for result in context.session.results.iter_test_results()
        ], datetime.timedelta()).total_seconds()

        e = E(
            'testsuite', {
                "name": "slash-suite",
                "hostname": socket.getfqdn(),
                "timestamp": self._start_time.isoformat().rsplit(".", 1)[0],
                "time": str(suite_time),
                "tests": str(context.session.results.get_num_results()),
                "errors": str(context.session.results.get_num_errors()),
                "failures": str(context.session.results.get_num_failures()),
                "skipped": str(context.session.results.get_num_skipped()),
            })
        self._add_errors(e, context.session.results.global_result)
        for result in context.session.results.iter_test_results():
            test = E(
                "testcase", {
                    "name": result.test_metadata.address,
                    "classname": result.test_metadata.class_name or '',
                    "time": str(result.get_duration().total_seconds())
                })
            self._add_errors(test, result)

            for skip in result.get_skips():
                self._add_element(test, 'skipped', {'type': skip or ''})

            for detail_name, detail_value in result.details.all().items():
                if not isinstance(detail_value, list):
                    detail_value = [detail_value]

                for value in detail_value:
                    value = self._detail2xml('detail', detail_name, value)
                    test.append(value)

            e.append(test)

        with open(slash_config.root.plugin_config.xunit.filename,
                  "wb") as outfile:
            outfile.write(xml_to_string(e))
Example #5
0
    def session_end(self):

        if config.root.parallel.worker_id is not None:
            return

        e = E('testsuite', {
            "name": "slash-suite",
            "hostname": socket.getfqdn(),
            "timestamp": self._start_time.isoformat().rsplit(".", 1)[0],
            "time": "0",
            "tests": str(context.session.results.get_num_results()),
            "errors": str(context.session.results.get_num_errors()),
            "failures": str(context.session.results.get_num_failures()),
            "skipped": str(context.session.results.get_num_skipped()),
        })
        self._add_errors(e, context.session.results.global_result)
        for result in context.session.results.iter_test_results():
            test = E("testcase", {
                "name": result.test_metadata.address,
                "classname": result.test_metadata.class_name or '',
                "time": "0"
            })
            self._add_errors(test, result)

            for skip in result.get_skips():
                self._add_element(test, 'skipped', {'type': skip or ''})

            for detail_name, detail_value in result.details.all().items():
                self._add_element(test, 'detail', {'name': detail_name, 'value': detail_value})

            e.append(test)




        with open(slash_config.root.plugin_config.xunit.filename, "wb") as outfile:
            outfile.write(xml_to_string(e))
 def _highlight(string: fnl.e.String):
     xml = make_code_block(string.value.strip())
     html = xml_to_string(xml).decode()
     return fnl.e.BlockRaw(html)