历史报告生成Robotframework risto.py

历史报告生成Robotframework risto.py,robotframework,Robotframework,当我运行risto.py生成历史报告图时,我得到以下错误: #risto.py --output history.png output.xml output1.xml Traceback (most recent call last): File "/usr/local/bin/risto.py", line 505, in <module> Ristopy().main (sys.argv [1:]) File "/usr/local/bin/rist

当我运行risto.py生成历史报告图时,我得到以下错误:

#risto.py --output history.png output.xml output1.xml
Traceback (most recent call last):
    File "/usr/local/bin/risto.py", line 505, in <module>
       Ristopy().main (sys.argv [1:])
    File "/usr/local/bin/risto.py", line 428, in main
       viewer_open = self.plot_one_graph (args)
    File "/usr/local/bin/risto.py", line 442, in _plot_one_graph
       output = self._plot (stats, opts)
    File "/usr/local/bin/risto.py", line 455, in _plot
       plotter = Plotter (opts['tag'], not opts['nocritical'],
KeyError: 'nocritical'

#risto.py --version
risto.py 1.0.2

我不明白我错在哪里。

首先,你没有犯任何错误。risto.py代码本身第461行中有一个错误:

plotter = Plotter(opts['tag'],  not opts['nocritical'],
                      not opts['noall'], not opts['nototals'],
                      not opts['nopassed'], not opts['nofailed'],
                      opts['width'], opts['height'], opts['font'],
                      opts['marker'], opts['xticks'])
将其替换为以下内容:

plotter = Plotter(opts['tag'],  opts['critical'],
                      opts['all'], opts['totals'],
                      opts['passed'], opts['failed'],
                      opts['width'], opts['height'], opts['font'],
                      opts['marker'], opts['xticks'])
实际上,这是函数def_plotself,stats,opts:的内部,该函数由以下函数调用:

def _plot_one_graph(self, args):
    opts, paths = self._arg_parser.parse_args(args)
    stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
    output = self._plot(stats, opts)
    return output is None

如果在该函数中打印选项,您将获得字典选项的实际键。之后,我更改了上面的代码片段,现在工作正常。

首先,您没有犯任何错误。risto.py代码本身第461行中有一个错误:

plotter = Plotter(opts['tag'],  not opts['nocritical'],
                      not opts['noall'], not opts['nototals'],
                      not opts['nopassed'], not opts['nofailed'],
                      opts['width'], opts['height'], opts['font'],
                      opts['marker'], opts['xticks'])
将其替换为以下内容:

plotter = Plotter(opts['tag'],  opts['critical'],
                      opts['all'], opts['totals'],
                      opts['passed'], opts['failed'],
                      opts['width'], opts['height'], opts['font'],
                      opts['marker'], opts['xticks'])
实际上,这是函数def_plotself,stats,opts:的内部,该函数由以下函数调用:

def _plot_one_graph(self, args):
    opts, paths = self._arg_parser.parse_args(args)
    stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
    output = self._plot(stats, opts)
    return output is None

如果在该函数中打印选项,您将获得字典选项的实际键。之后,我更改了上面的代码片段,现在工作正常。

您必须修改并添加以下函数才能使risto正常工作:

def _plot_one_graph(self, args):
    opts, paths = self._arg_parser.parse_args(args)
    opts = self._handle_options(opts)
    stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
    output = self._plot(stats, opts)
    return output is None

def _handle_options(self, opts):
    if opts.get('critical') is None:
        opts['critical'] = True
    if opts.get('all') is None:
        opts['all'] = True
    if opts.get('totals') is None:
        opts['totals'] = True
    if opts.get('passed') is None:
        opts['passed'] = True
    if opts.get('failed') is None:
        opts['failed'] = True
    return opts

请与原始文件进行差异处理。

您必须修改并添加以下功能才能使RIST正常工作:

def _plot_one_graph(self, args):
    opts, paths = self._arg_parser.parse_args(args)
    opts = self._handle_options(opts)
    stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
    output = self._plot(stats, opts)
    return output is None

def _handle_options(self, opts):
    if opts.get('critical') is None:
        opts['critical'] = True
    if opts.get('all') is None:
        opts['all'] = True
    if opts.get('totals') is None:
        opts['totals'] = True
    if opts.get('passed') is None:
        opts['passed'] = True
    if opts.get('failed') is None:
        opts['failed'] = True
    return opts
请做一个差异,以获得与原始文件的差异