def _write_file(self, path, config, template):
     outfile = file_writer(path) \
         if is_string(path) else path  # unit test hook
     with outfile:
         model_writer = RobotModelWriter(outfile, self._js_model, config)
         writer = HtmlFileWriter(outfile, model_writer)
         writer.write(template)
示例#2
0
 def _write_file(self, path, config, template):
     outfile = file_writer(path) \
         if is_string(path) else path  # unit test hook
     with outfile:
         model_writer = RobotModelWriter(outfile, self._js_model, config)
         writer = HtmlFileWriter(outfile, model_writer)
         writer.write(template)
 def __enter__(self):
     if not self.output:
         path = self._output_path()
         if PY2 and self.format == self.tsv_format:
             self.output = binary_file_writer(path)
         else:
             self.output = file_writer(path, newline=self.line_separator)
     return self
示例#4
0
 def __enter__(self):
     if not self.output:
         path = self._output_path()
         if PY2 and self.format == self.tsv_format:
             self.output = binary_file_writer(path)
         else:
             self.output = file_writer(path, newline=self.line_separator)
     return self
示例#5
0
def DebugFile(path):
    if not path:
        LOGGER.info('No debug file')
        return None
    try:
        outfile = file_writer(path)
    except EnvironmentError as err:
        LOGGER.error("Opening debug file '%s' failed: %s" % (path, err.strerror))
        return None
    else:
        LOGGER.info('Debug file: %s' % path)
        return _DebugFileWriter(outfile)
示例#6
0
def create_jsdata(outxml, target):
    settings = RebotSettings({
        'name':
        '<Suite.Name>',
        'critical': ['i?'],
        'noncritical': ['*kek*kone*'],
        'tagstatlink': [
            'force:http://google.com:<kuukkeli&gt;',
            'i*:http://%1/?foo=bar&zap=%1:Title of i%1',
            '?1:http://%1/<&>:Title', '</script>:<url>:<title>'
        ],
        'tagdoc': [
            'test:this_is_*my_bold*_test',
            'IX:*Combined* and escaped <&lt; tag doc', 'i*:Me, myself, and I.',
            '</script>:<doc>'
        ],
        'tagstatcombine':
        ['fooANDi*:No Match', 'long1ORcollections', 'i?:IX', '<*>:<any>']
    })
    result = Results(settings, outxml).js_result
    config = {
        'logURL':
        'log.html',
        'title':
        'This is a long long title. A very long title indeed. '
        'And it even contains some stuff to <esc&ape>. '
        'Yet it should still look good.',
        'minLevel':
        'DEBUG',
        'defaultLevel':
        'DEBUG',
        'reportURL':
        'report.html',
        'background': {
            'fail': 'DeepPink'
        }
    }
    with file_writer(target) as output:
        writer = JsResultWriter(output, start_block='', end_block='')
        writer.write(result, config)
    print('Log:    ', normpath(join(BASEDIR, '..', 'rebot', 'log.html')))
    print('Report: ', normpath(join(BASEDIR, '..', 'rebot', 'report.html')))
示例#7
0
 def __enter__(self):
     if self._format == 'HTML':
         self._output_file = file_writer(self._output_path)
         return self._output_file
     return self._output_path
示例#8
0
 def _write_split_log(self, index, keywords, strings, path):
     with file_writer(path) as outfile:
         writer = SplitLogWriter(outfile)
         writer.write(keywords, strings, index, basename(path))
示例#9
0
 def _get_writer(self, inpath, outpath):
     if PY2 and self._is_tsv(inpath):
         return binary_file_writer(outpath)
     return file_writer(outpath, newline=self._options['line_separator'])
示例#10
0
 def _write_test_doc(self, suite, outfile, title):
     with file_writer(outfile) as output:
         model_writer = TestdocModelWriter(output, suite, title)
         HtmlFileWriter(output, model_writer).write(TESTDOC)
示例#11
0
 def _get_writer(self, inpath, outpath):
     if PY2 and self._is_tsv(inpath):
         return binary_file_writer(outpath)
     return file_writer(outpath, newline=self._options['line_separator'])
示例#12
0
 def _write_test_doc(self, suite, outfile, title):
     with file_writer(outfile) as output:
         model_writer = TestdocModelWriter(output, suite, title)
         HtmlFileWriter(output, model_writer).write(TESTDOC)
 def _write_split_log(self, index, keywords, strings, path):
     with file_writer(path) as outfile:
         writer = SplitLogWriter(outfile)
         writer.write(keywords, strings, index, basename(path))
示例#14
0
 def __enter__(self):
     if self._format == 'HTML':
         self._output_file = file_writer(self._output_path)
         return self._output_file
     return self._output_path
示例#15
0
 def _get_writer(self, path):
     try:
         return file_writer(path)
     except EnvironmentError as err:
         raise DataError(err.strerror)
示例#16
0
 def _get_writer(self, path):
     try:
         return file_writer(path)
     except EnvironmentError as err:
         raise DataError(err.strerror)