def gather_failed_tests(output): if output.upper() == 'NONE': return [] gatherer = GatherFailedTests() tests_or_tasks = 'tests or tasks' try: suite = ExecutionResult(output, include_keywords=False).suite suite.visit(gatherer) tests_or_tasks = 'tests' if not suite.rpa else 'tasks' if not gatherer.tests: raise DataError('All %s passed.' % tests_or_tasks) except: raise DataError("Collecting failed %s from '%s' failed: %s" % (tests_or_tasks, output, get_error_message())) return gatherer.tests
class Results(object): def __init__(self, settings, *sources): self._settings = settings self._sources = sources if len(sources) == 1 and isinstance(sources[0], Result): self._result = sources[0] self._prune = False self.return_code = self._result.return_code else: self._result = None self._prune = True self.return_code = -1 self._js_result = None @property def result(self): if self._result is None: include_keywords = bool(self._settings.log or self._settings.output) flattened = self._settings.flatten_keywords self._result = ExecutionResult(include_keywords=include_keywords, flattened_keywords=flattened, merge=self._settings.merge, rpa=self._settings.rpa, *self._sources) if self._settings.rpa is None: self._settings.rpa = self._result.rpa self._result.configure(self._settings.status_rc, self._settings.suite_config, self._settings.statistics_config) modifier = ModelModifier(self._settings.pre_rebot_modifiers, self._settings.process_empty_suite, LOGGER) self._result.suite.visit(modifier) self.return_code = self._result.return_code return self._result @property def js_result(self): if self._js_result is None: builder = JsModelBuilder(log_path=self._settings.log, split_log=self._settings.split_log, prune_input_to_save_memory=self._prune) self._js_result = builder.build_from(self.result) if self._prune: self._result = None return self._js_result
def result(self): if self._result is None: include_keywords = bool(self._settings.log or self._settings.output) flattened = self._settings.flatten_keywords self._result = ExecutionResult(include_keywords=include_keywords, flattened_keywords=flattened, merge=self._settings.merge, *self._sources) self._result.configure(self._settings.status_rc, self._settings.suite_config, self._settings.statistics_config) modifier = ModelModifier(self._settings.pre_rebot_modifiers, self._settings.process_empty_suite, LOGGER) self._result.suite.visit(modifier) self.return_code = self._result.return_code return self._result
def gather_failed_tests(output): if output.upper() == 'NONE': return [] gatherer = GatherFailedTests() try: ExecutionResult(output, include_keywords=False).suite.visit(gatherer) if not gatherer.tests: raise DataError('All tests passed.') except: raise DataError("Collecting failed tests from '%s' failed: %s" % (output, get_error_message())) return gatherer.tests