Ejemplo n.º 1
0
    def _generate_html(testsuites):
        values = {
            "total_tests": 0,
            "total_errors": 0,
            "total_failures": 0,
            "total_skipped": 0,
            "total_time": 0.0,
        }

        for testsuite in testsuites:
            values["total_tests"] += testsuite.tests
            values["total_errors"] += testsuite.errors
            values["total_failures"] += testsuite.failures
            values["total_skipped"] += testsuite.skipped
            values["total_time"] += testsuite.time

        values["total_success"] = ReportTestSuite.success_rate(
            values["total_tests"],
            values["total_errors"],
            values["total_failures"],
            values["total_skipped"],
        )
        values["summary_icon_class"] = ReportTestSuite.icon_class(
            values["total_tests"],
            values["total_errors"],
            values["total_failures"],
            values["total_skipped"],
        )
        values["testsuites"] = [ts.as_dict() for ts in testsuites]

        package_name, _, _ = __name__.rpartition(".")
        renderer = MustacheRenderer(package_name=package_name)
        html = renderer.render_name("junit_report.html", values)
        return html
Ejemplo n.º 2
0
    def _generate_html(testsuites):
        values = {
            'total_tests': 0,
            'total_errors': 0,
            'total_failures': 0,
            'total_skipped': 0,
            'total_time': 0.0
        }

        for testsuite in testsuites:
            values['total_tests'] += testsuite.tests
            values['total_errors'] += testsuite.errors
            values['total_failures'] += testsuite.failures
            values['total_skipped'] += testsuite.skipped
            values['total_time'] += testsuite.time

        values['total_success'] = ReportTestSuite.success_rate(
            values['total_tests'], values['total_errors'],
            values['total_failures'], values['total_skipped'])
        values['summary_icon_class'] = ReportTestSuite.icon_class(
            values['total_tests'], values['total_errors'],
            values['total_failures'], values['total_skipped'])
        values['testsuites'] = [ts.as_dict() for ts in testsuites]

        package_name, _, _ = __name__.rpartition('.')
        renderer = MustacheRenderer(package_name=package_name)
        html = renderer.render_name('junit_report.html', values)
        return html
    def __init__(self, *args, **kwargs):
        super(EnsimeGen, self).__init__(*args, **kwargs)

        self._renderer = MustacheRenderer(
            self.get_options().template_directory, __name__)
        self.project_filename = os.path.join(self.cwd, '.ensime')
        self.ensime_output_dir = os.path.join(self.gen_project_workdir, 'out')
Ejemplo n.º 4
0
 def _do_render(self, filename, args):
     package_name, _, _ = __name__.rpartition('.')
     renderer = MustacheRenderer(package_name=package_name)
     output_path = os.path.join(self._outdir, os.path.basename(filename))
     self.context.log.info('Generating {}'.format(output_path))
     html = renderer.render_name(filename, args)
     with safe_open(output_path, 'w') as outfile:
         outfile.write(html.encode('utf8'))
Ejemplo n.º 5
0
 def _do_render(self, filename, args):
     package_name, _, _ = __name__.rpartition(".")
     renderer = MustacheRenderer(package_name=package_name)
     output_path = os.path.join(self._outdir, os.path.basename(filename))
     self.context.log.info("Generating {}".format(output_path))
     html = renderer.render_name(filename, args)
     with safe_open(output_path, "w") as outfile:
         outfile.write(html)
     return output_path
Ejemplo n.º 6
0
    def __init__(self, port, settings):
        renderer = MustacheRenderer(settings.template_dir, __name__)

        class MyHandler(PantsHandler):
            def __init__(self, request, client_address, server):
                PantsHandler.__init__(self, settings, renderer, request,
                                      client_address, server)

        self._httpd = BaseHTTPServer.HTTPServer(('', port), MyHandler)
        self._httpd.timeout = 0.1  # Not the network timeout, but how often handle_request yields.
Ejemplo n.º 7
0
  def __init__(self, run_tracker, settings):
    Reporter.__init__(self, run_tracker, settings)
     # The main report, and associated tool outputs, go under this dir.
    self._html_dir = settings.html_dir

    # We render HTML from mustache templates.
    self._renderer = MustacheRenderer(settings.template_dir, __name__)

    # We serve files relative to the build root.
    self._buildroot = get_buildroot()
    self._html_path_base = os.path.relpath(self._html_dir, self._buildroot)

    # We write the main report body to this file object.
    self._report_file = None

    # We redirect stdout, stderr etc. of tool invocations to these files.
    self._output_files = defaultdict(dict)  # workunit_id -> {path -> fileobj}.
Ejemplo n.º 8
0
  def __init__(self, run_tracker, settings):
    super(HtmlReporter, self).__init__(run_tracker, settings)
     # The main report, and associated tool outputs, go under this dir.
    self._html_dir = settings.html_dir

    # We render HTML from mustache templates.
    self._renderer = MustacheRenderer(settings.template_dir, __name__)

    # We serve files relative to the build root.
    self._buildroot = get_buildroot()
    self._html_path_base = os.path.relpath(self._html_dir, self._buildroot)

    # We write the main report body to this file object.
    self._report_file = None

    # We redirect stdout, stderr etc. of tool invocations to these files.
    self._output_files = defaultdict(dict)  # workunit_id -> {path -> fileobj}.
    self._linkify_memo = {}

    # Map from filename to timestamp (ms since the epoch) of when we last overwrote that file.
    # Useful for preventing too-frequent overwrites of, e.g., timing stats,
    # which can noticeably slow down short pants runs with many workunits.
    self._last_overwrite_time = {}