(summary, report_template=None, report_dir=None)
return report_path
render html report with specified report name and template

    Args:
        report_template (str): specify html report template path
        report_dir (str): specify html report save directory
render html report with specified report name and template
render html report with specified report name and template
def render_html_report(summary, report_template=None, report_dir=None):
    """ render html report with specified report name and template

    Args:
        report_template (str): specify html report template path
        report_dir (str): specify html report save directory

    """
    if not report_template:
        report_template = os.path.join(
            os.path.abspath(os.path.dirname(__file__)),
            "templates",
            "report_template.html"
        )
        logger.log_debug("No html report template specified, use default.")
    else:
        logger.log_info("render with html report template: {}".format(report_template))

    logger.log_info("Start to render Html report ...")

    report_dir = report_dir or os.path.join(os.getcwd(), "reports")
    if not os.path.isdir(report_dir):
        os.makedirs(report_dir)

    start_at_timestamp = int(summary["time"]["start_at"])
    summary["time"]["start_datetime"] = datetime.fromtimestamp(start_at_timestamp).strftime('%Y-%m-%d %H:%M:%S')

    report_path = os.path.join(report_dir, "{}.html".format(start_at_timestamp))

    with io.open(report_template, "r", encoding='utf-8') as fp_r:
        template_content = fp_r.read()
        with io.open(report_path, 'w', encoding='utf-8') as fp_w:
            rendered_content = Template(
                template_content,
                extensions=["jinja2.ext.loopcontrols"]
            ).render(summary)
            fp_w.write(rendered_content)

    logger.log_info("Generated Html report: {}".format(report_path))

    return report_path
def render_html_report ( summary , report_template = None , report_dir = None ) : if not report_template : report_template = os . path . join ( os . path . abspath ( os . path . dirname ( __file__ ) ) , "templates" , "report_template.html" ) logger . log_debug ( "No html report template specified, use default." ) else : logger . log_info ( "render with html report template: {}" . format ( report_template ) ) logger . log_info ( "Start to render Html report ..." ) report_dir = report_dir or os . path . join ( os . getcwd ( ) , "reports" ) if not os . path . isdir ( report_dir ) : os . makedirs ( report_dir ) start_at_timestamp = int ( summary [ "time" ] [ "start_at" ] ) summary [ "time" ] [ "start_datetime" ] = datetime . fromtimestamp ( start_at_timestamp ) . strftime ( '%Y-%m-%d %H:%M:%S' ) report_path = os . path . join ( report_dir , "{}.html" . format ( start_at_timestamp ) ) with io . open ( report_template , "r" , encoding = 'utf-8' ) as fp_r : template_content = fp_r . read ( ) with io . open ( report_path , 'w' , encoding = 'utf-8' ) as fp_w : rendered_content = Template ( template_content , extensions = [ "jinja2.ext.loopcontrols" ] ) . render ( summary ) fp_w . write ( rendered_content ) logger . log_info ( "Generated Html report: {}" . format ( report_path ) ) return report_path