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
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)
def create_jsdata(outxml, target): settings = RebotSettings({ 'name': '<Suite.Name>', 'critical': ['i?'], 'noncritical': ['*kek*kone*'], 'tagstatlink': [ 'force:http://google.com:<kuukkeli>', '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 << 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')))
def __enter__(self): if self._format == 'HTML': self._output_file = file_writer(self._output_path) return self._output_file return self._output_path
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))
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'])
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 _get_writer(self, path): try: return file_writer(path) except EnvironmentError as err: raise DataError(err.strerror)