def __init__(self, config, stats, error, monitor, monitorconfig, options, css_file=None): RenderRst.__init__(self, config, stats, error, monitor, monitorconfig, options) self.css_file = css_file self.report_dir = self.css_path = self.rst_path = self.html_path = None
def __init__(self, config, stats, error, monitor, options): options.html = True RenderRst.__init__(self, config, stats, error, monitor, options)
def main(): """ReportBuilder main.""" parser = OptionParser(USAGE, formatter=TitledHelpFormatter(), version="FunkLoad %s" % get_version()) parser.add_option("-H", "--html", action="store_true", default=False, dest="html", help="Produce an html report.") parser.add_option("--org", action="store_true", default=False, dest="org", help="Org-mode report.") parser.add_option("-P", "--with-percentiles", action="store_true", default=True, dest="with_percentiles", help=("Include percentiles in tables, use 10%, 50% and" " 90% for charts, default option.")) parser.add_option("--no-percentiles", action="store_false", dest="with_percentiles", help=("No percentiles in tables display min, " "avg and max in charts.")) cur_path = os.path.abspath(os.path.curdir) parser.add_option("-d", "--diff", action="store_true", default=False, dest="diffreport", help=("Create differential report.")) parser.add_option("-t", "--trend", action="store_true", default=False, dest="trendreport", help=("Build a trend reprot.")) parser.add_option("-o", "--output-directory", type="string", dest="output_dir", help="Parent directory to store reports, the directory" "name of the report will be generated automatically.", default=cur_path) parser.add_option("-r", "--report-directory", type="string", dest="report_dir", help="Directory name to store the report.", default=None) parser.add_option( "-T", "--apdex-T", type="float", dest="apdex_t", help="Apdex T constant in second, default is set to 1.5s. " "Visit http://www.apdex.org/ for more information.", default=Apdex.T) parser.add_option("-x", "--css", type="string", dest="css_file", help="Custom CSS file to use for the HTML reports", default=None) parser.add_option("", "--skip-definitions", action="store_true", default=False, dest="skip_definitions", help="If True, will skip the definitions") parser.add_option("-q", "--quiet", action="store_true", default=False, dest="quiet", help=("Report no system messages when generating" " html from rst.")) options, args = parser.parse_args() if options.diffreport: if len(args) != 2: parser.error("incorrect number of arguments") trace("Creating diff report ... ") output_dir = options.output_dir html_path = RenderDiff(args[0], args[1], options, css_file=options.css_file) trace("done: \n") trace("%s\n" % html_path) elif options.trendreport: if len(args) < 2: parser.error("incorrect number of arguments") trace("Creating trend report ... ") output_dir = options.output_dir html_path = RenderTrend(args, options, css_file=options.css_file) trace("done: \n") trace("%s\n" % html_path) else: if len(args) < 1: parser.error("incorrect number of arguments") if len(args) > 1: trace("Merging results files: ") f = NamedTemporaryFile(prefix='fl-mrg-', suffix='.xml') tmp_file = f.name f.close() MergeResultFiles(args, tmp_file) trace("Results merged in tmp file: %s\n" % os.path.abspath(tmp_file)) args = [tmp_file] options.xml_file = args[0] Apdex.T = options.apdex_t xml_parser = FunkLoadXmlParser() xml_parser.parse(options.xml_file) if options.html: trace("Creating html report: ...") html_path = RenderHtml(xml_parser.config, xml_parser.stats, xml_parser.error, xml_parser.monitor, xml_parser.monitorconfig, options, css_file=options.css_file)() trace("done: \n") trace(html_path + "\n") elif options.org: from ReportRenderOrg import RenderOrg print unicode( RenderOrg(xml_parser.config, xml_parser.stats, xml_parser.error, xml_parser.monitor, xml_parser.monitorconfig, options)).encode("utf-8") else: print unicode( RenderRst(xml_parser.config, xml_parser.stats, xml_parser.error, xml_parser.monitor, xml_parser.monitorconfig, options)).encode("utf-8")
def __init__(self, config, stats, error, monitor, monitorconfig, options): options.html = True RenderRst.__init__(self, config, stats, error, monitor, monitorconfig, options)