Example #1
0
def merge(
    result_files,
    rebot_options,
    tests_root_name,
    copied_artifacts,
    invalid_xml_callback=None,
):
    assert len(result_files) > 0
    if invalid_xml_callback is None:
        invalid_xml_callback = lambda: 0
    settings = RebotSettings(rebot_options)
    critical_tags = []
    non_critical_tags = []
    if ROBOT_VERSION < "4.0":
        critical_tags = settings.critical_tags
        non_critical_tags = settings.non_critical_tags
    merged = merge_groups(
        result_files,
        critical_tags,
        non_critical_tags,
        tests_root_name,
        invalid_xml_callback,
        settings.output_directory,
        copied_artifacts,
    )
    if len(merged) == 1:
        if not merged[0].suite.doc:
            merged[
                0].suite.doc = "[https://pabot.org/?ref=log|Pabot] result from %d executions." % len(
                    result_files)
        return merged[0]
    else:
        return ResultsCombiner(merged)
Example #2
0
    def write_results(self, settings=None, **options):
        """Writes results based on the given ``settings``  or ``options``.

        :param settings: :class:`~robot.conf.settings.RebotSettings` object
            to configure result writing.
        :param options: Used to construct new
            :class:`~robot.conf.settings.RebotSettings` object if ``settings``
            are not given.
        """
        settings = settings or RebotSettings(options)
        results = Results(settings, *self._sources)
        if settings.output:
            self._write_output(results.result, settings.output)
        if settings.xunit:
            self._write_xunit(results.result, settings.xunit,
                              settings.xunit_skip_noncritical)
        if settings.log:
            config = dict(settings.log_config,
                          minLevel=results.js_result.min_level)
            self._write_log(results.js_result, settings.log, config)
        if settings.report:
            results.js_result.remove_data_not_needed_in_report()
            self._write_report(results.js_result, settings.report,
                               settings.report_config)
        return results.return_code
Example #3
0
 def main(self, datasources, **options):
     settings = RebotSettings(options)
     LOGGER.register_console_logger(**settings.console_logger_config)
     LOGGER.disable_message_cache()
     rc = ResultWriter(*datasources).write_results(settings)
     if rc < 0:
         raise DataError('No outputs created.')
     return rc
Example #4
0
def merge(result_files, rebot_options, tests_root_name):
    assert len(result_files) > 0
    settings = RebotSettings(rebot_options)
    merged = merge_groups(result_files, settings.critical_tags,
                          settings.non_critical_tags, tests_root_name)
    if len(merged) == 1:
        return merged[0]
    else:
        return ResultsCombiner(merged)
Example #5
0
 def main(self, datasources, **options):
     settings = RebotSettings(options)
     LOGGER.register_console_logger(colors=settings['MonitorColors'],
                                    stdout=settings['StdOut'],
                                    stderr=settings['StdErr'])
     LOGGER.disable_message_cache()
     rc = ResultWriter(*datasources).write_results(settings)
     if rc < 0:
         raise DataError('No outputs created.')
     return rc
Example #6
0
 def main(self, datasources, **options):
     settings = RebotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     if settings['XUnitSkipNonCritical']:
         LOGGER.warn(
             "Command line option --xunitskipnoncritical has been deprecated."
         )
     LOGGER.disable_message_cache()
     rc = ResultWriter(*datasources).write_results(settings)
     if rc < 0:
         raise DataError('No outputs created.')
     return rc
Example #7
0
 def main(self, datasources, **options):
     try:
         settings = RebotSettings(options)
     except:
         LOGGER.register_console_logger(stdout=options.get('stdout'),
                                        stderr=options.get('stderr'))
         raise
     LOGGER.register_console_logger(**settings.console_output_config)
     LOGGER.disable_message_cache()
     rc = ResultWriter(*datasources).write_results(settings)
     if rc < 0:
         raise DataError('No outputs created.')
     return rc
Example #8
0
 def main(self, datasources, **options):
     settings = RebotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     if settings['Critical'] or settings['NonCritical']:
         LOGGER.warn("Command line options --critical and --noncritical have been "
                     "deprecated and have no effect with Rebot. Use --skiponfailure "
                     "when starting execution instead.")
     if settings['XUnitSkipNonCritical']:
         LOGGER.warn("Command line option --xunitskipnoncritical has been "
                     "deprecated and has no effect.")
     LOGGER.disable_message_cache()
     rc = ResultWriter(*datasources).write_results(settings)
     if rc < 0:
         raise DataError('No outputs created.')
     return rc
Example #9
0
def merge(result_files,
          rebot_options,
          tests_root_name,
          invalid_xml_callback=None):
    assert (len(result_files) > 0)
    if invalid_xml_callback is None:
        invalid_xml_callback = lambda: 0
    settings = RebotSettings(rebot_options)
    merged = merge_groups(result_files, settings.critical_tags,
                          settings.non_critical_tags, tests_root_name,
                          invalid_xml_callback)
    if len(merged) == 1:
        if not merged[0].suite.doc:
            merged[
                0].suite.doc = '[https://pabot.org/?ref=log|Pabot] result from %d executions.' % len(
                    result_files)
        return merged[0]
    else:
        return ResultsCombiner(merged)
Example #10
0
 def settings(self):
     """Get options as post-processed RebotSettings for output generation.
     """
     settings = RebotSettings(**self.options)
     return settings